-->
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: Prevent one-to-one association from updating
PostPosted: Wed Jan 23, 2008 10:51 am 
Beginner
Beginner

Joined: Tue May 17, 2005 2:48 pm
Posts: 47
NHibernate version:
1.2.1.4000

Mapping documents:
<class name="Employee" table="Employee" >
<id name="ID" column="EmployeeID">
<generator class="identity" />
</id>

<one-to-one name="SalesPerson" cascade="delete" />
</class>

Name and version of the database you are using:
SQL Server 2005


I have an Employee object which has a one-to-one association with a SalesPerson object. When I update the Employee object, I see that also an update query is executed for the SalesPerson table. This is something I don't want. Is there a way to tell NHibernate the SalesPerson object shouldn't be updated? I already tried setting the cascade attribute for the one-to-one element to 'delete' (leaving out save-update) in my mapping file, to no avail.

Can anybody help me?

Greets,
Jack


Top
 Profile  
 
 Post subject: Dynamic Update?
PostPosted: Wed Jan 23, 2008 1:27 pm 
Newbie

Joined: Fri Jan 18, 2008 7:45 pm
Posts: 18
Location: Eugene, OR
I'm still new at this, so I may be incorrect. I'd look into using the dynamic-update / dynamic-insert parameters in your Employee or SalesPerson xml mapping.

http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/mapping.html#mapping-declaration-class

_________________
Woil / Will Shaver / http://primedigit.com/


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.