-->
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.  [ 2 posts ] 
Author Message
 Post subject: may not deref. collection with cascade=all-delete-orphan&quo
PostPosted: Tue Oct 11, 2005 1:29 pm 
Newbie

Joined: Tue Oct 11, 2005 1:00 pm
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

The problem, obviously, only happens when I try to modify existing activtiy object that contains a set of locations, which, the set, has cascade="all-delete-orphan". Please help.

Hibernate version:
version 2

Mapping documents:
excerpt from Activity object mapping file containing this set

<!-- bi-directional one-to-many association to Address -->
<set
name="activityLocations"
lazy="true"
inverse="true"
cascade="all-delete-orphan"
>
<meta attribute="field-description">
@hibernate.set
lazy="true"
inverse="true"
cascade="save-update"

@hibernate.collection-key
column="ACTIVITY_ID"

@hibernate.collection-one-to-many
class="gov.hud.cpd.edsys.business.ActivityLocation"
</meta>
<key>
<column name="ACTIVITY_ID" />
</key>
<one-to-many
class="gov.hud.cpd.edsys.business.ActivityLocation"
/>
</set>


Full stack trace of any exception that occurs:

I am getting the following error:
You may not dereference a collection with cascade="all-delete-orphan"

Caused by: net.sf.hibernate.HibernateException: You may not dereference a collection with cascade="all-delete-orphan"
at net.sf.hibernate.impl.SessionImpl.updateUnreachableCollection(SessionImpl.java:2951)
at net.sf.hibernate.impl.SessionImpl.flushCollections(SessionImpl.java:2816)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2282)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2260)
at gov.hud.cpd.common.util.HibernateUtil.closeSession(HibernateUtil.java:86)

I know that this usually happens if the collection was set to null and a new collection was assigned, but I am using:
activity.getAddresses().clear();
activity.getAddresses().addAll(newCollection);


Name and version of the database you are using:

Oracle 9

The generated SQL (show_sql=true):
Hibernate: select activity0_.ACTIVITY_ID as ACTIVITY1_0_, activity0_.DESCRIPTION as DESCRIPT2_0_, activity0_.NAME as NAME0_, activity0_.PROJECTED_START_DATE as PROJECTE4_0_, activity0_.PROJECTED_END_DATE as PROJECTE5_0_, activity0_.TOTAL_ACTIVITY_BUDGET as TOTAL_AC6_0_, activity0_.SUB_GRANTEE as SUB_GRAN7_0_, activity0_.LOCATION_DESCRIPTION as LOCATION8_0_, activity0_.DESIGNEE_REFERENCE as DESIGNEE9_0_, activity0_.COMMENTS as COMMENTS0_, activity0_.PROPOSFUNDING as PROPOSF11_0_, activity0_.HQ_DISPOSITION_DATE as HQ_DISP12_0_, activity0_.OTHER_FUND as OTHER_FUND0_, activity0_.ROW_STATUS_ID as ROW_STA14_0_, activity0_.RESPONSIBLE_ORGANIZATION as RESPONS15_0_, activity0_.NATIONAL_OBJECTIVE_ID as NATIONA16_0_, activity0_.ACTIVITY_STATUS_ID as ACTIVIT17_0_, activity0_.ACTIVITY_TYPE_ID as ACTIVIT18_0_, activity0_.PROJECT_ID as PROJECT_ID0_ from ACTIVITY activity0_ where activity0_.ACTIVITY_ID=?
Hibernate: select activityst0_.ACTIVITY_STATUS_ID as ACTIVITY1_0_, activityst0_.ABBREVIATION as ABBREVIA2_0_, activityst0_.DESCRIPTION as DESCRIPT3_0_, activityst0_.ROW_STATUS_ID as ROW_STAT4_0_ from ACTIVITY_STATUS activityst0_ where activityst0_.ACTIVITY_STATUS_ID=?
Hibernate: select activityty0_.ACTIVITY_TYPE_ID as ACTIVITY1_0_, activityty0_.ABBREVIATION as ABBREVIA2_0_, activityty0_.DESCRIPTION as DESCRIPT3_0_, activityty0_.ROW_STATUS_ID as ROW_STAT4_0_, activityty0_.PROGRAM_ID as PROGRAM_ID0_ from ACTIVITY_TYPE activityty0_ where activityty0_.ACTIVITY_TYPE_ID=?
Hibernate: select program0_.PROGRAM_ID as PROGRAM_ID0_, program0_.PROGRAM_TYPE as PROGRAM_2_0_, program0_.PROGRAM_DESIGNATOR as PROGRAM_3_0_, program0_.PROGRAM_SHORT as PROGRAM_4_0_, program0_.PROGRAM_LONG as PROGRAM_5_0_, program0_.DESCRIPTION as DESCRIPT6_0_ from PROGRAM program0_ where program0_.PROGRAM_ID=?
Hibernate: select project0_.PROJECT_ID as PROJECT_ID0_, project0_.NAME as NAME0_, project0_.DESCRIPTION as DESCRIPT3_0_, project0_.GRANTS_ID as GRANTS_ID0_ from PROJECT project0_ where project0_.PROJECT_ID=?
Hibernate: select grant0_.GRANTS_ID as GRANTS_ID0_, grant0_.GRANT_NUMBER as GRANT_NU2_0_, grant0_.DESCRIPTION as DESCRIPT3_0_, grant0_.APPROPRIATION_CODE as APPROPRI4_0_, grant0_.APPROPRIATION_NAME as APPROPRI5_0_, grant0_.HUD_SIGNATURE_DATE as HUD_SIGN6_0_, grant0_.GRANTEE_SIGNATURE_DATE as GRANTEE_7_0_, grant0_.CONTRACT_EFFECTIVE_DATE as CONTRACT8_0_, grant0_.CONTRACT_END_DATE as CONTRACT9_0_, grant0_.STATUTORY_DATE as STATUTO10_0_, grant0_.GRANT_AMT as GRANT_AMT0_, grant0_.PROGRAM_INCOME_WAIVER_DATE as PROGRAM12_0_, grant0_.STATE_GRANTEE_FLAG as STATE_G13_0_, grant0_.STATE_ADMIN_PLAN_CAP as STATE_A14_0_, grant0_.PUBLIC_SERVICE_CAP as PUBLIC_15_0_, grant0_.ADMIN_PLAN_CAP as ADMIN_P16_0_, grant0_.LOW_MOD_PERCENT as LOW_MOD17_0_, grant0_.MATCH_PERCENT as MATCH_P18_0_, grant0_.PERFORMANCE_REVIEW_DUE_DATE as PERFORM19_0_, grant0_.PERFORMANCE_REVIEW_EXT_DATE as PERFORM20_0_, grant0_.REACTIVATE_DATE as REACTIV21_0_, grant0_.INSERT_TIMESTAMP as INSERT_22_0_, grant0_.LAST_UPDATE_TIMESTAMP as LAST_UP23_0_, grant0_.ROW_STATUS_ID as ROW_STA24_0_, grant0_.GRANT_STATUS_ID as GRANT_S25_0_, grant0_.HUD_OFFICE_ID as HUD_OFF26_0_, grant0_.REPORT_CYCLE_ID as REPORT_27_0_, grant0_.GRANTEE_ID as GRANTEE_ID0_, grant0_.LAST_UPDATE_USER_ID as LAST_UP29_0_, grant0_.INSERT_USER_ID as INSERT_30_0_, grant0_.PROGRAM_ID as PROGRAM_ID0_ from GRANTS grant0_ where grant0_.GRANTS_ID=?
Hibernate: select grantstatu0_.GRANT_STATUS_ID as GRANT_ST1_0_, grantstatu0_.ABBREVIATION as ABBREVIA2_0_, grantstatu0_.DESCRIPTION as DESCRIPT3_0_, grantstatu0_.ROW_STATUS_ID as ROW_STAT4_0_ from GRANT_STATUS grantstatu0_ where grantstatu0_.GRANT_STATUS_ID=?
Hibernate: select reportcycl0_.REPORT_CYCLE_ID as REPORT_C1_0_, reportcycl0_.ABBREVIATION as ABBREVIA2_0_, reportcycl0_.DESCRIPTION as DESCRIPT3_0_, reportcycl0_.ROW_STATUS_ID as ROW_STAT4_0_ from REPORT_CYCLE reportcycl0_ where reportcycl0_.REPORT_CYCLE_ID=?
Hibernate: select grantee0_.GRANTEE_ID as GRANTEE_ID0_, grantee0_.FULL_GRANTEE_ID as FULL_GRA2_0_, grantee0_.NAME as NAME0_, grantee0_.ADDRESS_1 as ADDRESS_10_, grantee0_.ADDRESS_2 as ADDRESS_20_, grantee0_.ADDRESS_3 as ADDRESS_30_, grantee0_.CITY as CITY0_, grantee0_.ZIP as ZIP0_, grantee0_.ZIP_EXT as ZIP_EXT0_, grantee0_.PHONE as PHONE0_, grantee0_.EXTENSION as EXTENSION0_, grantee0_.FAX as FAX0_, grantee0_.EMAIL as EMAIL0_, grantee0_.DUNS as DUNS0_, grantee0_.INSERT_TIMESTAMP as INSERT_15_0_, grantee0_.LAST_UPDATE_TIMESTAMP as LAST_UP16_0_, grantee0_.ROW_STATUS_ID as ROW_STA17_0_, grantee0_.STATE_GRANTEE_FLAG as STATE_G18_0_, grantee0_.TAX_ID as TAX_ID0_, grantee0_.CONGRESSIONAL_DISTRICT as CONGRES20_0_, grantee0_.GRANTEE_STATUS_ID as GRANTEE21_0_, grantee0_.HUD_OFFICE_ID as HUD_OFF22_0_, grantee0_.STATE as STATE0_, grantee0_.LAST_UPDATE_USER_ID as LAST_UP24_0_, grantee0_.INSERT_USER_ID as INSERT_25_0_ from GRANTEE grantee0_ where grantee0_.GRANTEE_ID=?
Hibernate: select granteesta0_.GRANTEE_STATUS_ID as GRANTEE_1_0_, granteesta0_.ROW_STATUS_ID as ROW_STAT2_0_, granteesta0_.ABBREVIATION as ABBREVIA3_0_, granteesta0_.DESCRIPTION as DESCRIPT4_0_ from GRANTEE_STATUS granteesta0_ where granteesta0_.GRANTEE_STATUS_ID=?
Hibernate: select state0_.STATE as STATE0_, state0_.NAME as NAME0_ from STATE state0_ where state0_.STATE=?
Hibernate: select contactdat0_.GRANTEE_ID as GRANTEE_ID__, contactdat0_.CONTACT_DATA_ID as CONTACT_2___, contactdat0_.CONTACT_TYPE_ID as CONTACT_3___ from GRANTEE_CONTACT contactdat0_ where contactdat0_.GRANTEE_ID=?
Hibernate: select measuretyp0_.ACTIVITY_TYPE_ID as ACTIVITY1___, measuretyp0_.MEASURE_TYPE_ID as MEASURE_2___, measuretyp1_.MEASURE_TYPE_ID as MEASURE_1_0_, measuretyp1_.DESCRIPTION as DESCRIPT2_0_, measuretyp1_.ROW_STATUS_ID as ROW_STAT3_0_ from ACTIVITY_TYPE_MEASURE_TYPE measuretyp0_ inner join MEASURE_TYPE measuretyp1_ on measuretyp0_.MEASURE_TYPE_ID=measuretyp1_.MEASURE_TYPE_ID where measuretyp0_.ACTIVITY_TYPE_ID=?
Hibernate: select activitylo0_.ACTIVITY_LOCATION_ID as ACTIVITY1_0_, activitylo0_.ADDRESS_1 as ADDRESS_10_, activitylo0_.ADDRESS_2 as ADDRESS_20_, activitylo0_.ADDRESS_3 as ADDRESS_30_, activitylo0_.CITY as CITY0_, activitylo0_.COUNTY_ID as COUNTY_ID0_, activitylo0_.STATE as STATE0_, activitylo0_.ZIP as ZIP0_, activitylo0_.CENSUS_TRACT as CENSUS_T9_0_, activitylo0_.ACTIVITY_ID as ACTIVIT10_0_ from ACTIVITY_LOCATION activitylo0_ where activitylo0_.ACTIVITY_LOCATION_ID=?
Hibernate: select activityme0_.ACTIVITY_ID as ACTIVITY1___, activityme0_.PROJECTED_QUANTITY as PROJECTE2___, activityme0_.INSERT_TIMESTAMP as INSERT_T3___, activityme0_.LAST_UPDATE_TIMESTAMP as LAST_UPD4___, activityme0_.ROW_STATUS_ID as ROW_STAT5___, activityme0_.MEASURE_TYPE_ID as MEASURE_6___, activityme0_.MEASURE_CATEGORY_ID as MEASURE_7___, activityme0_.INSERT_USER_ID as INSERT_U8___, activityme0_.LAST_UPDATE_USER_ID as LAST_UPD9___ from ACTIVITY_MEASURE activityme0_ where activityme0_.ACTIVITY_ID=? order by activityme0_.MEASURE_TYPE_ID, activityme0_.MEASURE_CATEGORY_ID
Hibernate: select measuretyp0_.MEASURE_TYPE_ID as MEASURE_1_0_, measuretyp0_.DESCRIPTION as DESCRIPT2_0_, measuretyp0_.ROW_STATUS_ID as ROW_STAT3_0_ from MEASURE_TYPE measuretyp0_ where measuretyp0_.MEASURE_TYPE_ID=?
Hibernate: select activitylo0_.ACTIVITY_ID as ACTIVIT10___, activitylo0_.ACTIVITY_LOCATION_ID as ACTIVITY1___, activitylo0_.ACTIVITY_LOCATION_ID as ACTIVITY1_0_, activitylo0_.ADDRESS_1 as ADDRESS_10_, activitylo0_.ADDRESS_2 as ADDRESS_20_, activitylo0_.ADDRESS_3 as ADDRESS_30_, activitylo0_.CITY as CITY0_, activitylo0_.COUNTY_ID as COUNTY_ID0_, activitylo0_.STATE as STATE0_, activitylo0_.ZIP as ZIP0_, activitylo0_.CENSUS_TRACT as CENSUS_T9_0_, activitylo0_.ACTIVITY_ID as ACTIVIT10_0_ from ACTIVITY_LOCATION activitylo0_ where activitylo0_.ACTIVITY_ID=?
15115871 [service-j2ee-2] ERROR gov.hud.cpd.common.util.HibernateUtil - HibernateException caught:
r: net.sf.hibernate.HibernateException: You may not dereference a collection with cascade="all-delete-orphan"
net.sf.hibernate.HibernateException: You may not dereference a collection with cascade="all-delete-orphan"


Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject: please disregardt this post
PostPosted: Tue Oct 11, 2005 2:12 pm 
Newbie

Joined: Tue Oct 11, 2005 1:00 pm
Posts: 2
I have found the error, it was a different collection that had the same cascade options and was not being loaded.


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