Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

unmapped entity

 
Vallaru smitha
Ranch Hand
Posts: 87
Firefox Browser Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

have 2 tables for which i have created a pojo with required fields and running hibernateUtil.createsql query. Below is my query



but I am getting a nullpointer when i try. Could any one please suggest me where I am doing wrong or if there is any other way.

thanks
 
Anantha Sharma
Ranch Hand
Posts: 43
Android Hibernate jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you need to use openSession instead of getCurrentSession()... since the thread doesnot have a session linked to it (refer to OpenSessionInViewFilter), the getCurrentSession() would return null.. hence the exception.

 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!