This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why update() is necessary?

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
If we have a detached object and want to reconnect it to Session, we call update() method.
But really, why this is necessary? I mean what happens under the hood?
Thanks.
 
Walter Bernstein
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"What happens under the hood?"

=> your object gets reconnected/attached to the current hibernate session.
=> at some point hibernate tries to update your object in the db.

I prefer session.lock() to reconnect a object.
 
Walter Bernstein
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"But really, why this is necessary?"

=> If an object is not connected to a hibernate session, it is not managed by hibernate. So any change to your object will not be persisted.
[ December 26, 2007: Message edited by: Walter Bernstein ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic