-->
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.  [ 5 posts ] 
Author Message
 Post subject: Synchronizing from database to object
PostPosted: Tue Dec 12, 2006 7:07 pm 
Newbie

Joined: Thu Nov 23, 2006 5:00 pm
Posts: 19
I know that hibernate can do presistence the object to database.

However, can hibernate handle the synchronization from database to object?

That means if there is some changes in database (the changes are done through some other ways), can hibernate know there is some changes in the database and hibernate can be notified for these changes?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 13, 2006 12:19 am 
Newbie

Joined: Thu Aug 10, 2006 12:25 am
Posts: 13
You can use refresh, which hibernates updates its cache/object info from the database.

Don't think there is any automatic way


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 13, 2006 10:02 am 
Newbie

Joined: Thu Nov 23, 2006 5:00 pm
Posts: 19
keyzervega wrote:
You can use refresh, which hibernates updates its cache/object info from the database.

Don't think there is any automatic way

Thanks.
I have read a lot of things and I also think there is no way to automatically update the object from database. That is what I mainly concern.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 13, 2006 2:37 pm 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
I don't think it's even technically possible. It would imply that you've got some sort of trigger (to use the db vocabulary) that would call some sort of listener. I don't if this feature even exists in any of the existing db (though I'd be interested in knowing it if ever possible).

So, the only solution you have is to call refresh(), or clear() the session so as to be sure hibernate will be forced to access the db to get the object, so as to be more up to date.

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 14, 2006 3:55 pm 
Newbie

Joined: Thu Nov 23, 2006 5:00 pm
Posts: 19
I think there are 2 ways to realize this.
1. by trigger. In database, write some trigger to call corresponding application.
2. Using message. In database, broadcast the message.
However, both of these ways need some work in database side. I am not sure database can support this or not. However, I think these should be supported.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.