Hello John,
One way might be to use a seperate query to return the max values and then find the Records matching those values. This can be done in a subquery such as:
"SELECT record FROM Record record WHERE Id = (SELECT max(Id) FROM Record )"
Of course, this should return records with only the max ID. You could order them by versionNumber and then only take the first Record returned:
query = em.createQuery("SELECT record FROM Record record WHERE Id = (SELECT max(Id) FROM Record ) ORDER BY record.versionNumber"
query.setMaxRows(1);
There are probably many ways to do the same thing though.
Best Regards,
Chris
[Message sent by forum member 'chris_delahunt' (chris_delahunt)]
http://forums.java.net/jive/thread.jspa?messageID=300387