-->
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: Component with empty collection must be null?..
PostPosted: Wed Jul 28, 2010 6:31 am 
Regular
Regular

Joined: Thu Aug 28, 2003 2:42 pm
Posts: 77
Location: The Netherlands
I have a component (embedded object) that contains a few fields and a collection.
The hibernate doc says (ch 8) that when all component fields are null, the component itself is null.
This is great, however my component contains a collection which doesn't follow the null-semantic such that it's never null, but instead empty.
But if the the collection is empty, I want the component to be null as well :(...

Any idea how to do this?

Some code:
Code:
         <component name="wage" class="com.bv.core.domain.category.impl.WageDefault">
            <property name="hasEmployerWage" type="boolean" column="inMemEmpWage"/>
            <property name="hasTipReceived" type="boolean" column="inMemTip"/>
            <property name="hasStockRightReceived" type="boolean" column="inMemStock"/>

                 <set name="employerWages" cascade="all" lazy="false"  >
               &catsSetDefault;
               <one-to-many entity-name="mIWaEmp"/>
            </set>
         </component>


If I comment out the "set" it works and the wage instance is null but I also want it to be null when the set is empty ...


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.