问题
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!
回答1:
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)
- ensure the syntactical correctness of a broader range of queries at compile time (compared to pure JPQL queries)
- build dynamic, type safe queries
- (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
来源:https://stackoverflow.com/questions/25014572/advantage-of-using-jpametamodelentityprocessor