• Post Reply Bookmark Topic Watch Topic
  • New Topic

insert doesn't work on hibernate

 
kapil munjal
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Whenever I try to insert data through hibernate into DB, it displays all the steps executed but it doesn't insert a new row into the database. Please tell me what could be the possible cause for this.

The code for my class is

Regards
Kapil
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing happens in a database without a transaction. Have a read of the linked Wiki entry and you should see how to fix this issue.
 
Vijay Gadde
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Replace your try block with this code and check what happens.
I can say that your missing the Transaction bit in your code

Regards,VIJAY
 
permaculture is largely about replacing oil with people. And one 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!