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: NHibernate.TransientObjectException on session.SaveOrUpdateC
PostPosted: Fri Jul 27, 2007 12:02 pm 
Newbie

Joined: Sat May 21, 2005 10:16 pm
Posts: 15
Greetings,

I just switched over to the 1.2GA and am having trouble with existing code that worked before, but after I made my migration changes (this post means I must have missed one) I notice when I try to save an object with a many-to-many mapping it throws a NHibernate.TransientObjectException on session.SaveOrUpdateCopy

Here is the many-to-many mapping

<component name="Cities" class="MyComp.CityCol, MyComp">
<bag name="InnerList" cascade="none" lazy="true" table="`user-citylist`">
<key column="UserID" />
<many-to-many class="MyComp.City, MyComp" column="CityID" />
</bag>
</component>


Here is the cit mapping

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping default-access="property" xmlns="urn:nhibernate-mapping-2.2">
<class name="MyComp.City, MyComp" lazy="false" table="`citylist`">
<id name="ID" type="UInt32" unsaved-value="0">
<generator class="identity" />
</id>
<version name="Version" type="UInt32" />
<property name="EditTimestamp" not-null="true" type="DateTime" />
<property name="CreationTimestamp" not-null="true" type="DateTime" />
<property name="Name" not-null="true" type="String" />
</class>
</hibernate-mapping>[/quote]


Top
 Profile  
 
 Post subject: Fixed?
PostPosted: Fri Jul 27, 2007 3:21 pm 
Newbie

Joined: Sat May 21, 2005 10:16 pm
Posts: 15
Greetings,

So on my mapping I added cascade="save-update" instead of cascade="none" and it fixed the issue.

I see other many-to-many mappings and the cascade="none" and there are not any errors on the save - what am I missing?

What also changed in 1.2GA that broke this 1.0 code?

Thanks for your replies in advance.

Kind regards,

Cable


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.