问题描述:

I have the following repository:

public interface ProductRepository extends JpaRepository<Product, Long>

Where the Product is an entity (annotated with @Entity).

Now I want to customize the Product entity.

I created a new entity called CustProduct that extends Product entity and I added to it some new fields.

I prefer that the ProductRepository will handle also the CustProduct entity, so I changed the repository definition to :

public interface <T extends Product> ProductRepository extends JpaRepository<T, Long>

When I'm running the application I see that even if I'm making the injection:

@Injection

private ProductRepository repo<CustProduct>;

The repository is created with Product entity and not CustProduct entity.

Do I need also to do something with the @EntityScan annotation, that right now scans the both packages - the one with Product entity and the one with CustProduct entity.

The packages are in different projects and the @EntityScan annotaion is located in the project where Product entity is.

相关阅读:
Top