What are some of the real world example where JPA2 Criteria API is more preferable?

后端 未结 4 1310
不思量自难忘°
不思量自难忘° 2020-12-13 10:15

I have taken a look at JPA 2.0 Criteria API, but I found it to be too cumbersome unlike Hibernate Criteria. Is there any good reason to use JPA 2.0 Criteria API rather than

4条回答
  •  长情又很酷
    2020-12-13 10:18

    JPA 2 Criteria can be used in statically typed form if you generate the entity metamodel. It is more verbose than JPQL, but is statically typed and supports dynamic query construction directly.

    The benefits of a statically typed query language is that you can catch more errors at compile time and IDE features like autocomplete can be used as well.

提交回复
热议问题