-->
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: self-referencing object & CGLIB problem
PostPosted: Thu May 05, 2005 5:07 pm 
Beginner
Beginner

Joined: Thu May 05, 2005 4:49 pm
Posts: 30
I'm getting this exception:

Code:
org.hibernate.HibernateException: Don't dereference a collection with cascade="all-delete-orphan": od.domain.Category.childCategories


Hibernate version: 3.0.2

Mapping documents:

Code:
<class name="Category" table="categories">
     
      <id name="id" type="long" unsaved-value="null">
         <generator class="native" />
      </id>
      <version name="version" />
      <property name="created" type="timestamp" not-null="true" />
     
      <property name="name" />

      <many-to-one name="parentCategory" class="Category"
         cascade="none" column="parent_id" />
     
      <set name="childCategories" cascade="all-delete-orphan" table="categories" sort="natural">
         <key column="parent_id" />
         <one-to-many class="Category" />
      </set>
     
   </class>


My query is:
"from Category c where c.parentCategory is null"

I put a log.error() statement in my setChildCategories() method, and it's indeed being called twice. Then I intentionally threw an exception the second time it was called, to see what was calling it the second time. My stack trace for this exception begins with:

Code:
exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of od.domain.Category.setChildCategories; nested exception is org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of od.domain.Category.setChildCategories


It seems like CGLIB would check whether the collection it's setting has all-delete-orphan cascade for it? I'm not thinking about something right... someone please help! Thanks.


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.