-->
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.  [ 1 post ] 
Author Message
 Post subject: ComponentType null value behaviour
PostPosted: Fri Dec 21, 2007 4:56 pm 
Newbie

Joined: Fri Dec 21, 2007 3:52 pm
Posts: 2
I am having some problems with a component mapping. I have a class which maps a certain property as a component. Call it Parent. Call the component class Component.

When I save the Parent with a Component consisting only of null property values and then reload the Parent the component property is now null. So far so good. This is exactly as per the documentation.

If I now set the component property of the reloaded parent to a new empty Component instance and flush the session, the parent gets saved, even though the new component is supposed to be equivalent to null.

This appears to be because ComponentType.isDirty returns true if either the old value or the new value (but not both) is null.

Code:
      if ( x == y ) {
         return false;
      }
      if ( x == null || y == null ) {
         return true;
      }


Is there someway that I can avoid this spurious update?

For reference, this happens in version 3.2.5.ga. I have produced a minimal test case with the classes Parent and Component which I can attach if clarification is needed.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.