• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

is saveOrUpdate() = update() + flush()?

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a single table with 3 columns and 1 primary key. My use case is the same as mentioned here, https://www.hibernate.org/116.html#A22,

* the application loads an object in the first session
* the object is passed up to the UI tier
* some modifications are made to the object
* the object is passed back down to the business logic tier
* the application persists these modifications by calling update() in a second session

My observation was if I used update() to persist the modifications, I needed to call flush() method to persist the changes to the database. Whereas, if I used saveOrUpdate(), the changes were persisted in the database without flush(). What my simple understanding of saveOrUpdate() was if it was not there execute a SQL INSERT a new row otherwise SQL UPDATE the exisiting row with the new data. Is there anything else I not aware of?

I am using Wicket with org.springframework.orm.hibernate3.support.OpenSessionInViewFilter filter
Thanks

/lim/
 
reply
    Bookmark Topic Watch Topic
  • New Topic