Hi David,One other thing that occurs to me is whether you're using the native query appropriately.
I assume that Entry.class is *not* an Entity. It's just a plain old Java class with no persistence annotations.
Perhaps we can help better if you would include your Entity.java and schema in the message. And the exception with stack trace.
Regards, Craig On Jan 22, 2008, at 2:55 AM, David Beer wrote:
Hi PatrickI will be able to get the exact information retruned later when I am back home.I am trying to display a list of the items returned from the query in a JList (javax.swing.JList). A JList takes either an array, a ListModel or a Vector; I was trying to use a Vectory as I can just add elements to it and not worry about memory allocation or the size of the Vector being too large.My point is that when I tried to cast the resulting data from the query I got an exception. Cannot Cast Delegate org.apache.openjpaI will get the exact data this evening when i get home Thanks David ----- Original Message ---- From: Patrick Linskey <[EMAIL PROTECTED]> To: [email protected]; [EMAIL PROTECTED] Sent: Monday, 21 January, 2008 11:52:15 PM Subject: Re: Understanding getResultList() Hi,and in return I am seeing a list containing a delegate and a persistence object.Can you include a printout of the data you see, or some more detailed explanation, such as class names of the instances returned?display. This is fine with a small amount of records but what about a large amount of records.Are you concerned about the overhead involved in iterating through a result list fully just to copy it over to the Vector? If the framework that you are using does not provide any interface-based support, then you might not have many options. One idea might be to try to create a subclass of Vector that overrides most methods to just return values from the actual backing list. -Patrick On Jan 21, 2008 3:34 PM, David Beer <[EMAIL PROTECTED]> wrote:Hi All I have a n issue with using Query getResultList(), I am executing a nativeQuery("SELECT * FROM ENTRY", Entry.class). And performing the query like so List<Entry> results =(List<Entry>)query.getResultList();and in return I am seeing a list containing a delegate and a persistence object. My main problem is that I am trying to display the resulting datathatcomes back in a JList, in order to set the list data on a JList youhaveto have the data in a Vector. So when I tried to cast the List to a Vector I got an exception. When I perform the same query using TopLink I get back a list ofObjectsof the type and no extra information. At the moment I am goingthroughthe results and getting each Object element and adding to Vector to display. This is fine with a small amount of records but what about a large amount of records. What is the best way of getting back just a list of Objects no additional data? Thanks David-- Patrick Linskey 202 669 5907
Craig Russell Architect, Sun Java Enterprise System http://java.sun.com/products/jdo 408 276-5638 mailto:[EMAIL PROTECTED] P.S. A good JDO? O, Gasp!
smime.p7s
Description: S/MIME cryptographic signature
