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 ...