users@glassfish.java.net

Re: How to Sort / OrderBy _at_OneToMany

From: <glassfish_at_javadesktop.org>
Date: Tue, 18 Sep 2007 09:48:35 PDT

Not a problem in not understanding. I'm still an egg myself :)

The @OrderBy is all you should need to have then if you are never modifying the List of Objectattributes. When the Object instantiated and its persistent state is recovered from the database, the List that is put into the Attributes member should be in the correct order. If this is not happening, then I'm a little at a loss.

If this is an application that is deployed to Glassfish, I would go to the Glassfish Admin Console and set the logging level to FINEST for the JPA logging property. This will dump out the actual SQL statements that are being used to retrieve the data. You should see the native "order by" within the query.

If this is a standalone persistence application, then you can add:

      <property name="toplink.logging.level" value="FINEST"/>

to your "persistence.xml" and it will also dump out the native SQL statements being used.
[Message sent by forum member 'bbergquist' (bbergquist)]

http://forums.java.net/jive/thread.jspa?messageID=235874