Unable to get Entity back from database as the Entity object. [message #665241] |
Wed, 13 April 2011 16:28  |
Eclipse User |
|
|
|
So, I am up and running with Helios (for Java EE Developers) and trying to hit our databasae (Sybase) to retrieve data from some (any) table.
Also installed EclipseLink 2.0 (did I need this?)
I created a Java class to align with a DB table and added javax.persistence.* annotations, setter and getters and implemented Serializable.
I have test code that uses EntityManagerFactory to get an EntityManager that uses createNativeQuery(...).getResultList() and I do get a result list. However the result list contains Objects rather than my Entity objects. While debuging I can see the contents of the object but get a casting exception anytime I try to use the Object as an Entity.
I then found the "Entities From Tables" and re-generated my entity this way - essentially the same class but, still get the same Object result.
[Ljava.lang.Object; cannot be cast to com.jpa.test.ImagePerson
at com.jpa.test.Main.main(Main.java:29)
What am I missing, doing wrong or not doing?
-mike
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04327 seconds