-->
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: [Question] Notification from Hibernate
PostPosted: Fri Apr 09, 2004 5:58 am 
Newbie

Joined: Wed Apr 07, 2004 11:28 pm
Posts: 6
Application should be notified and refresh the UI to display the new state after one session flushed the changes of data. How can it be implemented? Could I register some listener to Hibernate? and how?


Top
 Profile  
 
 Post subject: Re: [Question] Notification from Hibernate
PostPosted: Fri Apr 09, 2004 4:50 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
niciyou wrote:
Application should be notified and refresh the UI to display the new state after one session flushed the changes of data. How can it be implemented? Could I register some listener to Hibernate? and how?


Have a look to the Interceptor stuff... You may catch the onUpdate()/onSave() callbacks and fire an event trapped by your GUI...


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 11, 2004 6:30 am 
Newbie

Joined: Wed Apr 07, 2004 11:28 pm
Posts: 6
I have read about it. But the onSave() and onUpdate() is invoked before the session flush according to document. So it will get the old state when other session refresh at this time.

And the onSave() and onUpdate() is defined in Interface LifeCycle. If I want use this two method, every class persistent need implement it or inherit the class implement it. It is not I desired. I wish my persistent class clean and pure.

I think the hibernate should furnish a mechanism to notify outside when session flush. It somes like a Resource NotificationManager to notify the Listener registered. So the persistent class need not to implement the LifeCycle interface.

I have seen the mechanism used in WorkSpace of Eclipse Platform which works as a resource manager.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 11, 2004 10:32 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
If you checked out the Inteceptor interface, then you probably noticed the callback methods onFlushDirty(), preFlush(), and postFlush(), right? Depending on your exact requirement, one of these methods will suffice.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 12, 2004 11:05 am 
Newbie

Joined: Wed Apr 07, 2004 11:28 pm
Posts: 6
I am sorry I did not read all of the document.
It is I desired.

Thanks every one for help:)


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.