-->
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: not-null violation when using cascade="all-delete-orpha
PostPosted: Fri Oct 29, 2004 2:02 pm 
Newbie

Joined: Thu Oct 21, 2004 7:02 am
Posts: 14
When trying to update an User object after removing one of the UserRole's from its userRoles collection, I get "Try to insert null into a non-nullable column" when it tries to update the USERROLE table... Anyone know why this happens? I use cascade="all-delete-orphan" in the User mapping.

Hibernate version:
2.1.2
Mapping documents:
<class name="org.hisp.dhis.user.model.User" table="`USER`">
<id name="userId" type="integer" column="USERID" unsaved-value="any">
<meta attribute="scope-set">protected</meta>
<generator class="native"/>
</id>
<property name="userName" type="string" column="USERNAME" not-null="true" unique="true"/>
<property name="surName" type="string" column="SURNAME"/>
<property name="firstName" type="string" column="FIRSTNAME"/>
<set name="userRoles"
table="USERROLE"
lazy="false"
cascade="all-delete-orphan">
<key column="USERID"/>
<one-to-many class="org.hisp.dhis.user.model.UserRole"/>
</set>
</class>

<class name="org.hisp.dhis.user.model.UserRole" table="USERROLE">
<composite-id>
<key-property name="userId" type="integer" column="USERID"/>
<key-many-to-one name="role" class="org.hisp.dhis.user.model.Role" column="ROLEID"/>
</composite-id>
<timestamp name="timeStamp" unsaved-value="null" column="TIMESTAMP"/>
</class>

Full stack trace of any exception that occurs:
Caused by: java.sql.SQLException: Try to insert null into a non-nullable column: column: USERID table: USERROLE in statement [update USERROLE set USERID=null where USERID=?]
Name and version of the database you are using:
hsqldb


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.