使用JPAMetaModelEntityProcessor的优点? [英] Advantage of using JPAMetaModelEntityProcessor?

查看:316
本文介绍了使用JPAMetaModelEntityProcessor的优点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



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

使用 JPAMetaModelEntityProcessor

谢谢!

解决方案

总之, 编译时提供的实体的元模型可帮助您减少运行时错误的数量。

,你可以使用元模型(目前为止还没有详尽的列表)


  1. 确保在编译时更广泛的查询的语法正确性(与纯JPQL查询相比)
  2. 构建动态类型安全查询
  3. (例如,使用Spring Data JPA> = 1.5)指定排序顺序,因为您不能像字符串一样引入任何拼写错误

Cf。 JPA 2.0中的动态,类型安全查询 Spring Data JPA


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!

解决方案

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

这篇关于使用JPAMetaModelEntityProcessor的优点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆