-->
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: "object references an unsaved transient instance"
PostPosted: Mon Sep 27, 2010 9:20 am 
Newbie

Joined: Mon Aug 23, 2010 6:34 am
Posts: 6
Hi!

I am using hibernate 3.3.2:

I have two Objects, let's call them Parent and Child.

Parent:
Code:
@OneToMany(targetEntity=Child.class)
   @Cascade(org.hibernate.annotations.CascadeType.ALL)
   @JoinTable(name="PARENT_CHILD")
   private List<Child> children = new ArrayList<Child>();


The Child objects are already in the Database.
When I want to save the Parent object, this error:
Code:
object references an unsaved transient instance - save the transient instance before flushing: main.Child

is thrown.

I don't understand, why hibernate thinks, that the child isn't saved.
Can I tell Hibernate somehow, that the Child objects are always in the DB before I save the Parent?

Any help is appreciated! :)


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.