-->
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: Assigned Identifiers and ISession's SaveOrUpdate() method
PostPosted: Mon Apr 03, 2006 2:58 am 
Beginner
Beginner

Joined: Mon Apr 03, 2006 2:41 am
Posts: 25
Location: Mauritius
Hi all,

I'm reading the documentation of NHibernate in order to know if it fits to my needs.

I got objects from a webservice and I want to persist them to a database.

The class are generated from Visual Studio and I would prefer not to modify them.

At the start of my reading, NHibernate seemed to be perfect for my needs because it doesn't require to change the Business object, in my case the generated class from the webservice.

Then I have found this in the documentation about "Assigned Identifier" id generator ( my identifiers are retrieved from the webservice).

Quote:
Due to its inherent nature, entities that use this generator cannot be saved via the ISession's SaveOrUpdate() method. Instead you have to explicitly specify to NHibernate if the object should be saved or updated by calling either the Save() or Update() method of the ISession.


the SavorUpdate method was a method which really interests me since it's exactly what I have to do.

Does the last version of NHibernate always contain this limitation ?
is this change planned before the end of this month ( I have a short dead line) ?

Thanks in advance for your feedback

Regards

Christophe


Top
 Profile  
 
 Post subject: The behaviour is unchanged
PostPosted: Wed Apr 05, 2006 12:33 pm 
Newbie

Joined: Mon Jun 27, 2005 5:12 am
Posts: 10
I'm using 1.02 and SaveorUpdate does fail if you try to persist a new entity with a identity whose value is not the unsaved-value when the identity generator is of the assiged type. I explicity call Save for such objects.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 06, 2006 12:55 am 
Beginner
Beginner

Joined: Mon Apr 03, 2006 2:41 am
Posts: 25
Location: Mauritius
Ok

Thanks for the information


Top
 Profile  
 
 Post subject: Re: The behaviour is unchanged
PostPosted: Thu Apr 06, 2006 3:27 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
CheekyTinker wrote:
I'm using 1.02 and SaveorUpdate does fail if you try to persist a new entity with a identity whose value is not the unsaved-value when the identity generator is of the assiged type. I explicity call Save for such objects.


AFAIK, NHibernate can also use a <version> attribute to distinguish betwwen saved/unsaved objects. See docs: http://www.hibernate.org/hib_docs/nhibernate/html/mapping.html#mapping-declaration-version

Gert


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 06, 2006 1:16 pm 
Beginner
Beginner

Joined: Mon Apr 03, 2006 2:41 am
Posts: 25
Location: Mauritius
Ok

Thanks

I will look at this


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.