• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

updating an object in hibernate  RSS feed

 
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.

 
author & internet detective
Marshal
Posts: 38659
675
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!