-->
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: cascading updates db even when save/update is not called
PostPosted: Thu Mar 30, 2006 3:25 pm 
Beginner
Beginner

Joined: Mon Jan 23, 2006 12:01 pm
Posts: 46
Hi,

Here's the scenario: I load an object from db, and create a bunch of child objects in it (simply as space holders). When the load method returns, and transaction is committed, cascading triggers an automatic flush, and all my temporary objects are being saved to db, without me even calling save or update methods. Is there a way to tell Hibernate to use cascade only when save or update method is called?
BTW, all my hibernate mapping files have this header:

<hibernate-mapping default-cascade="save-update">

But it doesn't look like this is helping.
I'd appreciate any help on the subject. Thank you,

Bratek


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 9:54 pm 
Newbie

Joined: Tue Feb 07, 2006 4:56 pm
Posts: 4
Location: San Diego, CA
You can do the following to the session:

Session session = HibernateUtil.getSession();
session.setFlushMode(FlushMode.NEVER);

Then you have to be explicit about your saves.

Hope this helps

Derek


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.