-->
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: Effect of cascade="save" on transient/persistent
PostPosted: Fri Feb 24, 2006 12:34 pm 
Newbie

Joined: Sun Apr 10, 2005 9:35 pm
Posts: 14
Hibernate version: 3.0

This is a general request for information about how the cascade attribute operates when you have transient objects associated with persistent objects.

Assuming the following mapping, which in OGNL would look something like this
Code:
event.eventDate
event.startTime
event.venue
event.venue.name
event.venue.addressFirstLine
...


Code:
<class name="Event">
    <property name="eventDate" type="date"/>
    <property name="startTime" type="time"/>
    <many-to-one name="venue" class="com.mydomain.Venue" column="venue_id"/>
</class>

<class name="Venue">
    <property name="name" type="string"/>
    <property name="addressFirstLine" type="string"/>
    ...
</class>


If I load a venue from the database, and associate it with a new Event object, what would be the effect of a cascade="save" on the many-to-one "venue" relation when saving the new Event object? Would it try to update the persistent Venue object?

If I have created a new Venue at the same time as the Event I would like it saved, but I don't want already-persisted Venues to be updated, as this is part of a separate business process.

Hope this makes sense.

Cheers,

Mike

Update - sorry: got the cascade style wrong. "save-update" makes this a completly irrelevant question.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 12:49 pm 
Expert
Expert

Joined: Mon Jan 09, 2006 5:01 pm
Posts: 311
Location: Sacramento, CA
check out 21.4. Cascades and unsaved-value
of the reference guide

for Many-to-One:
cascade (optional): Specifies which operations should be cascaded from the parent object to the associated object.

See page 59 at bottom for values of cascade.

here's the url to the reference.pdf.

http://www.hibernate.org/hib_docs/v3/reference/en/pdf/hibernate_reference.pdf

It is all explained pretty clearly there.

_________________
-JT

If you find my replies helpful, please rate by clicking 'Y' on them. I appreciate it.


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.