-->
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 determine dirty fields?
PostPosted: Thu Jun 25, 2009 1:46 am 
Newbie

Joined: Wed Jun 24, 2009 9:10 pm
Posts: 10
Hi,

I have one customer entity A that has 3 value types (primary info, secondayr info and logistics info) and 4 java.util.Collection fields (one-to-many entities like shipping addresses, insurance details, creditcards etc). When Hibernate finds customer entity is dirty because any of 4 one-to-many entities is dirty, I would like to identifiy those dirty fields. How can I do that?

Thanks,
Tapshil


Top
 Profile  
 
 Post subject: Re: How to determine dirty fields?
PostPosted: Thu Jun 25, 2009 6:25 pm 
Newbie

Joined: Thu Jun 25, 2009 3:45 am
Posts: 4
Enable Hibernate's logging to debug level and search for is dirty in the log. That will tell you exactly what property is detected to be dirty.


Top
 Profile  
 
 Post subject: Re: How to determine dirty fields?
PostPosted: Fri Jun 26, 2009 2:24 pm 
Newbie

Joined: Wed Jun 24, 2009 9:10 pm
Posts: 10
Thanks for the reply!

I forgot to mention that I need to know only dirty fields programmatically so that I can persist customer entity based on these dirty fields. For example, if my application finds that coverages field is modified, I don't want to persist customer entity in database. Below is my customer entity.

@Entity
@EntityListeners(value = { CustomListener.class })
@Table(name="MMGS_CUSTOMER")
@org.hibernate.annotations.Entity(
dynamicUpdate=true)
public class CustomerTO {

private Integer customerID;
private PrimaryTO primary;
private SecondaryTO secondary;
private Collection<InsuredCoverageTO> coverages = new ArrayList<InsuredCoverageTO>();
private Collection<PolicyOwnerTO> policyOwners = new ArrayList<PolicyOwnerTO>();
private Collection<ShipToInfoTO> shipping = new ArrayList<ShipToInfoTO>();
private Collection<PreferenceTO> preferences = new ArrayList<PreferenceTO>();
.....


Top
 Profile  
 
 Post subject: Re: How to determine dirty fields?
PostPosted: Fri Jun 26, 2009 2:31 pm 
Newbie

Joined: Wed Jun 24, 2009 9:10 pm
Posts: 10
Sorry, i made a mistake in explaining my requirement. Here is rephrased one:

I need to know only dirty fields so that I can do something based on these dirty fields. For example, if my application finds that coverages field is dirty, I would like to know that coverages field is one of the dirty fields. So, if coverages field is dirty, I need to marshall entire customer profile and send it to other application.


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.