Hibernate advanced select

Posted by Marcus on Stack Overflow See other posts from Stack Overflow or by Marcus
Published on 2010-03-30T20:41:43Z Indexed on 2010/03/30 20:43 UTC
Read the original article Hit count: 374

Filed under:
|
|

We want to get a row from a 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?

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about java