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