title: Handling entities inheritance spring boot
body: <p>I'm working with this <a href="http://blog.netgloo.com/2014/12/18/handling-entities-inheritance-with-spring-data-jpa/" rel="nofollow noreferrer">tutorial</a> to handle entities inheritance. I have person and company entities that extends the User entity.</p>
  
  <pre><code>@Entity
  @Inheritance
  public abstract class User { 
  
  @Id
  private long id;
  
  @NotNull
  private String email;
  
  // getters and settres
  }
  
  @Entity
  public class Person extends User { 
  private int age;
  // getters and settres and other attributs
  }
  
  @Entity
  public class Company extends User { 
  private String companyName;
  // getters and settres and other attribut
  }
  </code></pre>
  
  <p>then UserRpository ,PersonRepository and Company Repository that extends the UserBaseRepository.</p>
  
  <pre><code>@NoRepositoryBean
  public interface UserBaseRepository&lt;T extends User&gt; 
  extends CrudRepository&lt;T, Long&gt; {
  
  public T findByEmail(String email);
  
  }
  
  @Transactional
  public interface UserRepository extends UserBaseRepository&lt;User&gt; { }
  
  @Transactional
  public interface PersonRepository extends UserBaseRepository&lt;Person&gt; { }
  
  @Transactional
  public interface CompanyRepository extends UserBaseRepository&lt;Company&gt; { }
  </code></pre>
  
  <p>the probleme is when calling personRepository.findAll() to get all persons , in result i got also companies.</p>