-->
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: collection of composite-element updating instead of deleting
PostPosted: Fri Sep 02, 2005 7:58 pm 
Newbie

Joined: Fri Sep 02, 2005 3:15 am
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0.5

Mapping documents:


<set name="worklistRecords"
table="WORKLIST_RECORDS" cascade="all-delete-orphan">
<key column="ROLE_ID"/>
<composite-element class="WorklistRecord">
<parent name="Role"/>
<many-to-one name="SubSource" class="SubSource"
column="SUB_SOURCE_ID" not-null="true"/>
<many-to-one name="RecordStatus" class="RecordStatus"
column="RECORD_STATUS_ID" not-null="true"/>
<many-to-one name="RecordType" class="RecordType"
column="RECORD_TYPE_ID" not-null="true"/>
</composite-element>
</set>

Composite object mapping

<class name="WorklistRecord" table="WORKLIST_RECORDS">

<id column="WORKLIST_RECORD_ID" name="id" type="long"
unsaved-value="-1">
<generator class="native">
<param name="sequence">SEQ_WORKLIST_RECORD_ID</param>
</generator>
</id>

<many-to-one name="role" column="ROLE_ID"
not-null="true">
</many-to-one>

<many-to-one name="subSource" column="SUB_SOURCE_ID"
not-null="true">
</many-to-one>

<many-to-one name="recordStatus" column="RECORD_STATUS_ID"
not-null="true">
</many-to-one>

<many-to-one name="recordType" column="RECORD_TYPE_ID"
not-null="true">
</many-to-one>

</class>



using spring:

Full stack trace of any exception that occurs:

Oracle 8i:

Removing a WorklistRecord from the collection managed by the Roles class results in an update being called rather than a delete and a null error being thrown since I nullify the objects before removing. This is shown below.

public void removeWorklistRecord(WorklistRecord record) {

record.setRole(null);
record.setRecordStatus(null);
record.setRecordType(null);
record.setSubSource(null);
_worklistRecords.remove(record);
}


Any ideas, I've played with the inverse and cascade options but have not had any success. Inserts are working just fine.

thx
sean


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.