开发者

Hibernate advanced select

We want to get a row from a开发者_Python百科 table using Hibernate a la:

  1. select max(id) from mytable where date = <date>
  2. Then select * from mytable where id = <max_id>

We are currently using Hibernate to map mytable to Java domain objects.

I know how to load the domain object based on an id. So I could just do #1 using JDBC and then load the domain object using Hibernate the "normal" way.

But.. is there a way to do this with one single Hibernate logical query?


Try using subqueries.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜