-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to avoid a save from propagating?
PostPosted: Tue Sep 25, 2007 3:46 am 
Newbie

Joined: Tue Sep 25, 2007 3:33 am
Posts: 1
Location: Bangalore, India
Scenario is as follows

I have a car object, backed by a car table, and the car has wheels, backed by a wheels table, and the car is made by Honda, backed by a manufacturer's table. When I save the car in Hibernate, I want the cars table to be updated, as well as the wheels table, but NOT the manufacturers table. We shouldn't be saving anything to Honda/the manufacturer's table.

How do i achieve this in hibernate?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 26, 2007 11:12 am 
Beginner
Beginner

Joined: Tue Jan 18, 2005 9:37 am
Posts: 29
Location: The Netherlands
This is easy.
Just specify the cascade options.
I don't know if you're using annotations, but If you are,then it would be

Car{

@ManyToOne(cascade={CascadeType.REFRESH}, fetch=FetchType.EAGER)
Manufacturer m;

@ManyToMany(cascade={CascadeType.ALL}, fetch=FetchType.EAGER)
Collection<Wheel> wheels;


}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.