Converting SQL to HQL [closed]

折月煮酒 提交于 2019-12-04 13:53:27

Typically you HQL joins are specified using the property on the object, eg, if class Foo and Bar and Foo.bar is of type Bar, then from Foo f inner join f.bar as b is the join. As far as I know, there's no way of performing a self-join in HQL (I could be wrong here).

That said, Hibernate allows you to write (slightly enhanced) SQL queries with session.createSQLQuery(...).

Ended up changing to use native SQL and a PreparedStatement as it seems that Hibernate's session.createSQLQuery() will only work for Managed Entities.

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