-->
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: all-delete-orphan behaviour with arrays.
PostPosted: Tue Jul 05, 2005 9:07 pm 
Newbie

Joined: Mon Nov 29, 2004 8:15 pm
Posts: 6
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
2.1.7

Mapping documents:

<hibernate-mapping>
<class name="com.XmlFieldGroupTemplate" table="xmlfieldGroup" optimistic-lock="version" dynamic-update="true">
<id name="id" type="string" unsaved-value="null">
<column name="id" length="16"/>
<generator class="assigned"/>
</id>
<version name="version" column="version" unsaved-value="negative"/>
<array name="xmlFields" table="xmlgroupfields" cascade="all">
<key>
<column name="groupid" not-null="false"/>
</key>
<index column="idx"/>
<one-to-many class="com.XmlGroupFieldTemplate"/>
</array>
<class name="com.XmlGroupFieldTemplate" table="xmlgroupfields" optimistic-lock="version" dynamic-update="true">
<id name="id" type="string" unsaved-value="null">
<column name="id" length="16"/>
<generator class="assigned"/>
</id>
<version name="version" column="version" unsaved-value="negative"/>
<property name="nodeType" column="nodetype" type="string"/>
<property name="name" column="fieldname" type="string"/>
<many-to-one outer-join="false" name="parent" class="com.XmlGroupFieldTemplate" cascade="none" not-null="false">
<column name="parentid" sql-type="varchar(32)" not-null="false"/>
</many-to-one>

</class>
</hibernate-mapping>


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

Full stack trace of any exception that occurs:

Name and version of the database you are using:
Oracle 9.2.0.4.0

The generated SQL (show_sql=true):


Debug level Hibernate log excerpt:

Is there any way to simulate all-delete-orphan behaviour for Hibernate arrays, similar to other collections? As you can see from the mapping file, when I remove an instance of XmlGroupFieldTemplate from the collection the record for the same is not deleted from the database. Instead, the group ID is just updated to null.
This behaviour is not very favorable, since if I later on add an instance of XmlGroupFieldTemplate to the collection with the same id, then it causes an unique index constraint violation(because it tries to insert the record again).

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 05, 2005 11:55 pm 
Newbie

Joined: Mon Nov 29, 2004 8:15 pm
Posts: 6
Hi,

Could some one from the Hibernate team or otherwise please reply to my query, this is really urgent.
Since all-delete-orphan is currently not supported for <array> please let me know the best workaround for the same.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 06, 2005 12:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
sspawse wrote:
Could some one from the Hibernate team or otherwise please reply to my query, this is really urgent..


Sure, but first you'll need a support contract from sales@jboss.com


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.