• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

updating an object in hibernate

 
shivang sarawagi
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to update an object in hibernate but I don't understand why it is not getting updated in the db. Can anyone please help?

Controller class method



DAO Class



I am trying to update the city of the owner but I it's not getting updated. Here is what I get in the console.
Within the editOwner method I get the owner's city so I believe the value is passed properly. It's something to do with the method.
I tried with update, merge, saveOrUpdate but nothing seems to work.

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you in a tranasaction? Maybe the transaction hasn't gotten committed?

As a quick test you can try adding the line to see if it fixes the problem:
sessionFactory.getCurrentSession().connection().setAutoCommit(true);

If it does, you can then look through your Spring configuration to find the actual transaction controls.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic