user755806
user755806

Reputation: 6815

Advantage of using JPAMetaModelEntityProcessor?

I just went through below link.

http://hop2croft.wordpress.com/2011/07/07/criteria-jpa-2-0-and-database-metamodel-auto-generation-with-maven/

what is the advantage of using JPAMetaModelEntityProcessor?

Thanks!

Upvotes: 3

Views: 4174

Answers (1)

Hille
Hille

Reputation: 4196

In short, having a meta model of your entities available at compile time helps you reduce the number of run-time errors.

Specifically, with a meta model you may (list is by far not exhaustive)

  1. ensure the syntactical correctness of a broader range of queries at compile time (compared to pure JPQL queries)
  2. build dynamic, type safe queries
  3. (using e.g. Spring Data JPA >= 1.5) take advantage when e.g. specifying the sort order as you can't introduce any typos as in the case with strings

Cf. Dynamic, typesafe queries in JPA 2.0 and Spring Data JPA

Upvotes: 5

Related Questions