I need to return an entity object from a NamedQuery and I am having trouble.
So I want to return a row from the Revision table but where the row is equal to the passed in id (from the Test table) and has the max revision from the revision table. This NamedQuery almost does the trick but I am returning the max revision number from the revision table and not the actual revision entity.
What if you put the Max part into your where clause instead, using a subquery. So
If you want the Revisions collection in Test to be populated, then you ...
Wait which entity do you want back. It looks like you want the Revision object back. So
What is your mapping for this relationship, show bot Revision and Test, I am making some assumptions up there in the query that might be slightly off. But I hope you get my idea of the MAX being in a subquery.