-->
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.  [ 2 posts ] 
Author Message
 Post subject: one to many, why does it accept zero elements?
PostPosted: Mon May 22, 2006 7:15 pm 
Newbie

Joined: Mon Mar 27, 2006 2:06 pm
Posts: 5
Hibernate version: 3

I'm not having a bug per se, i just have a one to many assoc, but i CAN save zero elements on the many side. Is this right? is there a way to validate that the many side has at least one element, instead of zero? I mean, i could do it in the program side, but perhaps im mapping it wrong. My map looks like:

<hibernate-mapping>

<class name="com.ge.nbc.fcclicense.bus.license.domain.FCCLicense" table="FCC_LICENSE">

<id name="fccLicenseID" column="FCC_LICENSE_ID" type="long" unsaved-value="-1">
<generator class="sequence">
<param name="sequence">FCC_LICENSE_SEQ</param>
</generator>
</id>

<set name="transmitterSet" cascade="save-update" lazy="true" not-null="true" >
<key column="FCC_LICENSE_ID" />
<one-to-many class="com.ge.nbc.fcclicense.bus.license.domain.Transmitter" />
<filter name="filterDeleted" condition="DELETED_FLAG = 'N'"/>
</set>

</class>


thks very much in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 22, 2006 9:59 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
It's right, and there's nothing you can do in the mapping to require that at least one element be in a collection. It has to be done in business logic.

_________________
Code tags are your friend. Know them and use them.


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