-->
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: Is this structure possible to cascade over?
PostPosted: Wed Jul 18, 2007 7:38 am 
Newbie

Joined: Tue Oct 10, 2006 11:40 am
Posts: 4
I have a somewhat special structure that I am trying to cascade over. I have tried almost everything but I can't get it to work. The structure looks a little bit like this:

Code:
public class Container {
   long id;
   Set<AbstractParentClass> items;
}

public abstract class AbstractParentClass {
    Container container;
    long id;
}

public class Child1 extends AbstractParentClass {
   String foo;
}

public class Child2 extends AbstractParentClass {
    String bar;
}


I have a ContainerDAO and would like to be able to cascade and save the children when I save the Container. I write my mapping file something like this for the Container:
Code:
<set 
   name="items"
   cascade="all"
   lazy="false" >
      <key column="itemsId" />
       <one-to-many class="AbstractParentClass" />
</set>

But I always get an org.hibernate.TransientObjectException for the Child classes. Is there a solution except persisting the child objects before persisiting the Container?


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.