开发者

Grails HQL vs SQL Statements

I would like an opinion about qu开发者_StackOverflow社区erying the database using HQL or SQL Statements, concerning simplicity, complexity and performance.


With HQL you are operating on a class based domain level and with SQL on the relational model level. With HQL you can traverse your domain model in the queries and SQL you need to create the links with joins and join conditions which is more verbose.

Also the projections with HQL are simpler as you get directly objects out whereas with SQL you can tabular views of your relational data.

Optimizing HQL is more difficult as you need to operate on many levels (domain level, Hibernate, generated SQL, relational model), but mostly you can manage with less code.

SQL results are not typesafe, but this doesn't really matter as much in the Grails context as it would in a Java context.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜