-->
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: Can one-to-one mapping be null?
PostPosted: Mon Aug 23, 2004 3:06 pm 
Beginner
Beginner

Joined: Sat Mar 13, 2004 4:00 pm
Posts: 32
Can one-to-one mappings be set to null? I have an optional one-to-one relationship that when I set to null, I get the exception below. According to the DTD, I can't see an option for "not-null" on one-to-one relationships. Is there something I'm missing or is it not allowed?

Thanks,

Rich

Hibernate version:

2.1.6

Mapping documents:

<one-to-one
name="floatTerms"
class="com.rcm.securitiesservice.domain.BondFloatTerms"
cascade="all"
constrained="true"
outer-join="auto"
access="field"
/>



Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Caused by: java.lang.Exception: not-null property references a null or transient value: com.rcm.securitiesservice.domain.CorpBond.floatTerms
at net.sf.hibernate.impl.SessionImpl.checkNullability(SessionImpl.java:1277)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:928)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779)
at net.sf.hibernate.impl.SessionImpl.doCopy(SessionImpl.java:4013)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdateCopy(SessionImpl.java:3980)


Name and version of the database you are using:

Oracle 9

Debug level Hibernate log excerpt:


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.