wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes JPA - Hibernate - query.getResultList() returns 3 null values. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JPA - Hibernate - query.getResultList() returns 3 null values." Watch "JPA - Hibernate - query.getResultList() returns 3 null values." New topic
Author

JPA - Hibernate - query.getResultList() returns 3 null values.

Sharad Kharya
Ranch Hand

Joined: Oct 15, 2008
Posts: 68
I am new to JPA and developing my 1st JPA application with using MySQL DB and hibernate as persistence provider.

I created a Table with 3 rows.
When i am using JDBC approach, i am getting all the results correctly

But, when i use JPA mechanism, the query.getResultList() returns 3 null values.

I didn't understand where i did a mistake
Please help in resolving the issue -

Code/Schema details -
Schema details -




Code using JDBC approach - Test_Connection.java


Output -



Now JPA appraoch codes -
persistence.xml


Entity class - JPA_Class.java


Reading data code - read.java


Out of JPA logic when exected-
Sharad Kharya
Ranch Hand

Joined: Oct 15, 2008
Posts: 68
This got resolved -

i missed the mapping of id/prymary key with column name in Entity class.
line added -



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPA - Hibernate - query.getResultList() returns 3 null values.
 
Similar Threads
Serious error in JPA with @Version
Problem using Java Beans
JSP session
Please help me need urgent help on JPA connection
Simple JPA Program using Eclipselink 1.1 in Eclipse