• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to build session object in hibernate

 
Prateek Saxena
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm pretty new to hibernate. I've been trying to add some data to an existing table in mysql database using hibernate. But there is an error in my code. The session object is not being built. My code is as below:

add_user.java:



Users.java :




hibernate.cfg.xml:



users.hbm.xml:



The stack trace is as follows:


Can someone please help me. I've no idea why this is happening.


 
dhwani mathur
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prateek,


Can you please refer this link where in ServiceLayer you can see how session is being created and later a commit.


example1


and refer this below link.. create a transaction

example2


I hope that helps.




 
Prateek Saxena
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for your reply Dhwani. I've already implemented the changes you have mentioned. The project is working now. Apparently, it was an issue with conflicting jars. It's been sorted out now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic