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.  [ 3 posts ] 
Author Message
 Post subject: Delete causes updating not-null fields to null
PostPosted: Fri Nov 21, 2003 2:38 am 
Newbie

Joined: Fri Nov 21, 2003 2:20 am
Posts: 5
Hi,

I am trying to delete an object which has collection of child objects. The main object has some not null fields that Hibernate tries to update to null before delete. This causes error: SEVERE: Could not synchronize database state with session
java.sql.BatchUpdateException: ORA-01407: cannot update ("MYPROJECT"."USER_VIEWS"."NAME") to NULL.

I have seen a very similar posting where the answer was to set the many side (child objects) setting inverse="true". However, I do not know how to do this, because many-to-one column belongs to the composite-id of the child object.

Here are my mappings:

<class name="View" table="user_views">
<id name="id" type="string" column="user_view_id" unsaved-value="0">
<generator class="uuid.hex">
</generator>
</id>

<property name="name" type="string" not-null="true"/>
<property name="viewTypeName" type="string" column="uvie_type" not-null="true"/>
<property name="description" type="string"/>
<property name="maxAmount" type="integer" column="max_amount"/>
<property name="owner" type="string"/>

<set name="sortBys" table="user_view_sort" inverse="true" cascade="all-delete-orphan">
<key column="user_view_id"/>
<one-to-many class="SortBy"/>
</set>
</class>


<class name="SortBy" table="user_view_sorts">
<composite-id>
<key-property name="column" type="ColumnType" column="column_name"/>
<key-many-to-one name="view" class="View" column="user_view_id"/>
</composite-id>

<property name="ascending" type="boolean" column="is_asc"/>
<property name="index" type="integer" column="uvis_index"/>
</class>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 4:02 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I think its a mistype.

"user_view_sorts" vs "user_view_sort"


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 5:46 am 
Newbie

Joined: Fri Nov 21, 2003 2:20 am
Posts: 5
Well, it was a typo certainly, but unfortunately it didn't change the situation.


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