Advantage of using JPAMetaModelEntityProcessor?

淺唱寂寞╮ 提交于 2020-01-04 14:12:01

问题


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)

  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



来源:https://stackoverflow.com/questions/25014572/advantage-of-using-jpametamodelentityprocessor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!