-->
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: saving mappedBy properties
PostPosted: Fri Jun 27, 2008 9:34 am 
Beginner
Beginner

Joined: Wed May 14, 2008 2:06 pm
Posts: 21
@OneToMany(mappedBy = "mandatory",fetch = FetchType.LAZY)
public Set<DefaultParameter> getDefaultParameters() {
return defaultParameters;
}
I have the above property in my entity,when I save this entity hibernate will also save above property , does hibernate save the entity and its mapped properties ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 27, 2008 9:37 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
If you have a CascadeType of ALL, the save will cascade to the associated properties. If not, you may need to save each individual entity after the association has been made.

Here's some good Wiki information on saveing bi-directional relationships:

http://en.wikibooks.org/wiki/Java_Persi ... ationships

And here's a little tutorial on saving many-to-many mapped entities with Hiberante:


http://jpa.ezhibernate.com/Javacode/learn.jsp?tutorial=19mappingmanytomanyrelationships

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


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.