views:

42

answers:

1

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?

+1  A: 

Try using subqueries.

lexicore
Looks promising.. would help if I RTFM.
Marcus