-->
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.  [ 1 post ] 
Author Message
 Post subject: TransactionException - help with .Merge()
PostPosted: Thu May 14, 2009 11:46 am 
Beginner
Beginner

Joined: Thu Aug 14, 2008 5:31 pm
Posts: 20
Hi,

I'm trying to save an entity of type Post which contains a property CreatedBy of type SimplePerson. Here's the relevant mapping :

Code:
<many-to-one name="CreatedBy" class="Metrica.SimplePerson,Metrica" column="CreatedBy" cascade="merge" />


When I call

Code:
SessionManager.GetCurrentSession().Merge(pPost);


I get the following exception :

object references an unsaved transient instance - save the transient instance before flushing: Metrica.SimplePerson

I believe it is related to the fact that the SimplePerson associated to the Post I'm trying to save is null (in my database the field CreatedBy is nullable). How can I configure the mapping so that I can save my Post whether SimplePerson is null or not ?

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.