The moose likes Object Relational Mapping and the fly likes Is it possible to load a collection but not save it in Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "Is it possible to load a collection but not save it in Hibernate" Watch "Is it possible to load a collection but not save it in Hibernate" New topic
Author

Is it possible to load a collection but not save it in Hibernate

Chase Bonham
Ranch Hand

Joined: Jul 15, 2006
Posts: 50
<class name="eg.Parent">
<set name="children" cascade="all-delete-orphan" inverse="true" sort="unsorted" >
<key column="id" />
<one-to-many class="eg.Child" />
</set>

</class>

<class name="eg.Child">
<many-to-one name="parent" class="eg.Parent" not-null="true" insert="false" update="false" >
<column name="id" />
</many-to-one>
</class>



When I load Parent I want to load the children set, but when I want to
save Parent I don't want to save the children.
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
remove the cascade="all-delete-orphan" ?
 
 
subject: Is it possible to load a collection but not save it in Hibernate
 
Threads others viewed
retrieving object hierarchy - many-to-one?
Would like advise mapping Hibernate objects
when save parent, the children do not get saved
Parent-Child Mapping with Hibernate 2.0
what changes should i made in save method in one-to-many relationships
IntelliJ Java IDE