last « Fetch « JPA Q&A

1. Fetch last record in mysql

I want fetch last record using hibernate criteria Can u help me?

2. How to retrieve last "m" instances from a "1-n" relationship using JPQL?

Is there anyway to retrieve the last "m" instances from a 1 to n relationship using JPQL?
Ex. Retrieve the last "m" actions for the following "x" Users.

3. Hibernate only fetching the last in from an object's collection and not the whole collection?

Is this possible? I have an object that holds a collection (a large one). @OneToMany( mappedBy="topic" ) @OrderBy( "id DESC" ) private List topicVersions ; I am only interested in the last object in ( PK will be max ) is there a way to get a collection containing only the last one in or a way to have an single ...

4. Fastest way to retrieve the last (most recent) record?

Most Exalted Ones, My app has a number of large tables that are constantly updated by a backend C++ process. I need to get only the most recently added record. How can I do this through hibernate without getting the entire recordset? Hibernate doesn't do the inserts, so I can't use the last_insert or whatever it's called. thanks in advance!

5. Fetch Last Row of a table

6. HQL: How to fetch only the last record ?