Advanced Spring-Data JPA: Specifications and Querydsl
20,000 foot view
Stop creating a method for every query permutation. Specifications wrap the JPA Criteria API. Using them makes your code less - and then more - readable and reusable. Check them out.
If you don't like the ugliness that is implementing individual specifications, Querydsl based Specifications make everything better.
Do yourself a favor and read this article: Springsource Blog: Advanced Spring Data JPA Specifications and Querydsl
Note: JPA InheritanceType.JOINED
Hey, make sure to annotate child model classes with @PrimaryKeyJoinColumn when using InheritanceType.JOINED. This annotation allows you to specify the column names to be used in mapping parent child relationships.
Additional reading:
- API
- JEE 6 - Entity Inheritance Tutorial - fantastically incomplete
Its important to note that using this inheritance model requires an extra join operation when retrieving entities. This may negatively impact performance if running high volume or with anything other than trivial inheritance models.