• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

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

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This got resolved -

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



 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic