开发者

Hibernate: Query without SQL-strings?

开发者 https://www.devze.com 2022-12-13 09:53 出处:网络
Is it possible (and if yes, is it advisable) to do queries of Hibernate-mapped data without using SQL-strings, b开发者_运维问答ut some OOP way instead?use the Criteria API, more examples here.I am usi

Is it possible (and if yes, is it advisable) to do queries of Hibernate-mapped data without using SQL-strings, b开发者_运维问答ut some OOP way instead?


use the Criteria API, more examples here.


I am using linq. But HQL uses entities, so it should be named object-oriented :)


It's possible using Criteria, but I think the queries are generally more understandable when using HQL with parameters. Still, Criteria does work well for the queries that are quite dynamic (I've seen people concatenate HQL strings for dynamic queries, and Criteria is cleaner in those cases).

0

精彩评论

暂无评论...
验证码 换一张
取 消