-->
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: Listener to detect when a session becomes dirty
PostPosted: Mon Oct 17, 2005 9:46 am 
Newbie

Joined: Mon Oct 17, 2005 9:35 am
Posts: 3
Hi!

Is there an easy way to detect when a session becomes dirty?
I need a listener or something that notifies me as soon as
the state of an object under hibernate's control has been changed.

My application has a "save-button" which is normally disabled. It
should become enabled automatically when the users changes
the value of an object. I tried to use an interceptor to solve this problem,
but "onFlushDirty" is called not until the transaction is committed, which is
too late.
TIA

Thomas


Top
 Profile  
 
 Post subject: Re: Listener to detect when a session becomes dirty
PostPosted: Mon Oct 17, 2005 9:52 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
ap_develop wrote:
Hi!

Is there an easy way to detect when a session becomes dirty?
I need a listener or something that notifies me as soon as
the state of an object under hibernate's control has been changed.

My application has a "save-button" which is normally disabled. It
should become enabled automatically when the users changes
the value of an object. I tried to use an interceptor to solve this problem,
but "onFlushDirty" is called not until the transaction is committed, which is
too late.
TIA

Thomas


Do you really think it's good design to have your front-end functionality depend on your persistence mechanism ?

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject: Re: Listener to detect when a session becomes dirty
PostPosted: Mon Oct 17, 2005 10:01 am 
Newbie

Joined: Mon Oct 17, 2005 9:35 am
Posts: 3
pksiv wrote:
ap_develop wrote:
Hi!

Is there an easy way to detect when a session becomes dirty?
[...]


Do you really think it's good design to have your front-end functionality depend on your persistence mechanism ?


It doesn't matter what I think or don't think. It's a requirement
from the management I have to deal with.

Thomas


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 17, 2005 10:33 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
Don't build it into the persistence mechanism.Build it into the business model. When a POJO/Business entity becomes dirty fire an event that your GUI can resond to.

Pksiv is correct, you managers can demand what they like and their demands can be met in a sane and sensible manner.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 9:15 am 
Newbie

Joined: Mon Oct 17, 2005 9:35 am
Posts: 3
jamie_dainton wrote:
Don't build it into the persistence mechanism.Build it into the business model. When a POJO/Business entity becomes dirty fire an event that your GUI can resond to.



Thank you, I will do that.
Our old persistence framework had such a handy feature.
I hoped there was a similar one in hibernate.

Thomas


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.