-->
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.  [ 5 posts ] 
Author Message
 Post subject: disable cascade behavior
PostPosted: Tue Jun 02, 2009 4:39 am 
Newbie

Joined: Tue Jun 02, 2009 4:10 am
Posts: 3
Hi,

in my C# application I have a parent-child relation mapped the following way:
(Snippet shows mapping file from parent object)

Code:
   
    <property column="name" type="String" name="Name" not-null="false"  length="50"/>
    <property column="birthdate"  type="Date"  name="Birthdate" />
   
    <bag name="Childs" table="childs" cascade="all-delete-orphan" lazy="false">
      <key column="parent_id" />
      <one-to-many class="BuisnessClass.Child, BuisnessClass"/>
    </bag>


I use the cascade option for delete update and so on. For all scenarios the cascade behavior is very usefull an welcome.
I work with detached objects and as you can see without lazy loading.
But now I try to update just the birthdate from the parent-object without updating all the child-objects.

Is there a possibility to disable the cascade-behavior for just one database operation?

Thanks in advance


Top
 Profile  
 
 Post subject: Re: disable cascade behavior
PostPosted: Thu Jun 04, 2009 3:06 am 
Newbie

Joined: Tue Jun 02, 2009 4:10 am
Posts: 3
Sorry for pushing....

Nobody just an idea? Every simple hint might be usefull.


Top
 Profile  
 
 Post subject: Re: disable cascade behavior
PostPosted: Thu Jun 04, 2009 7:20 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
You can try using "dynamic-update" on the class mapping:

http://nhforge.org/doc/nh/en/index.html#mapping-declaration-class

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Re: disable cascade behavior
PostPosted: Thu Jun 04, 2009 9:55 am 
Newbie

Joined: Tue Jun 02, 2009 4:10 am
Posts: 3
The documentation says:

Quote:
Specifies that UPDATE SQL should be generated at runtime and contain only those columns whose values have changed.


I`m working with detached objects. How do NHibernate knows which columns have changed? Does it work in this case?


Top
 Profile  
 
 Post subject: Re: disable cascade behavior
PostPosted: Thu Jun 04, 2009 9:57 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Don't know, probably not, but it was the closest thing, I could think of. Maybe you can combine this with an IInterceptor with a custom dirty check.

_________________
--Wolfgang


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.