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! :)