-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: POJO & persistence question
PostPosted: Wed Sep 13, 2006 5:07 am 
Newbie

Joined: Mon Oct 17, 2005 4:10 am
Posts: 6
Hi

i have one question regarding persistence.

suppose if there are some records in a database table..
and suppose if i edit a record which is already present in the database table( i am editing a record in the database table itself when the application is already launched, and also i am not using session.update() method to edit the record).

now how does hibernate know that the record was updated in the table? how does the database convey a message to hibernate that the record has been updated? and when does hibernate persist this record?


Rgds,
Jim.


Top
 Profile  
 
 Post subject: Re: POJO & persistence question
PostPosted: Wed Sep 13, 2006 7:38 am 
Newbie

Joined: Tue Sep 12, 2006 7:03 am
Posts: 7
Location: Berlin
TJim wrote:

now how does hibernate know that the record was updated in the table? how does the database convey a message to hibernate that the record has been updated? and when does hibernate persist this record?


When you load (or instantiate) Hibernate Pojos from existing database records, the Pojos will contain the data from those records as it was at the time of loading. The Pojos will not reflect any changes to the database records until they are updated from the database. There are no messages that would automatically do this - you need to call the update method of a Hibernate Session.

You could use optimistic or pessimistic locking mechanisms to handle problems that may result from this behaviour.

Fritz


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.