-->
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.  [ 4 posts ] 
Author Message
 Post subject: How to find Dirty Objects?
PostPosted: Wed Sep 24, 2008 9:54 am 
Newbie

Joined: Fri Feb 29, 2008 7:05 am
Posts: 13
Location: New Delhi, India
Hi All,

I have got 2 entites in the parent child relationship. Whenever parent is persisted, I need to check for its dirty childs. This is because, I need to do some custom processing before dirty objects can be persisted.

Is there any way through which I can determine before hand if an object is Dirty or not. It will be great if there exist any such utility method through which it can be determined if an object is dirty or not without explicitly calling a finder and then to do equality check.

I hope that what Hibernate uses internally must be accessed and using that it can be determined if a particulr object is dirty or not.

Regards,
Nitin


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 10:03 am 
Newbie

Joined: Wed Sep 17, 2008 2:59 am
Posts: 10
Have you tried using an Interceptor ?

http://www.hibernate.org/hib_docs/v3/ap ... eptor.html


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 26, 2008 2:12 am 
Newbie

Joined: Fri Feb 29, 2008 7:05 am
Posts: 13
Location: New Delhi, India
Hi,

Yes I tried the adapter. In the case of save, it worked correctly. But in the case of Update, it did not. Actually, I have to change a child collection of the entity which is being persisted. I tried to set a collection on a instance variable of the entity in onDirtyFlush, but it returned a class cast exception. Some digging on the forums mentioned that Hibernate internally saves the collections in one of its own formats.

Can you give me a hint or a link on how I can manage the updates on child collections in the case of onDirtyFlush?


Thanks & Regards,
Nitin


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 27, 2008 11:44 pm 
Newbie

Joined: Wed Sep 17, 2008 2:59 am
Posts: 10
Post your code and mapping file.


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