Forums Register Login

Not able to build session object in hibernate

+Pie Number of slices to send: Send
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.


+Pie Number of slices to send: Send
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.




+Pie Number of slices to send: Send
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.
The first person to drink cow's milk. That started off as a dare from this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 990 times.
Similar Threads
[Help] Null Pointer Exception in session.flush() Hibernate
Hibernate exception problem
Exception while running hibernate - nubie
Can't connect to MySQL database with Hibernate
Hibernate problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 07:12:30.