-->
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: NHibernate issue with assigned string ID & character casing
PostPosted: Thu Jun 02, 2011 5:02 pm 
Newbie

Joined: Thu Jun 02, 2011 4:58 pm
Posts: 1
I've a problem when save an entity with assigned string Id on NHibernate...I try to explain the issue with an example.

Well, suppose to have an entity on database with ID "AAA", if I execute this statements

ENTITYTYPE entity = Session.Get<ENTITYTYPE>("AAA");
ENTITYTYPE newentity = new ENTITYTYPE() { Id = "aaa" };

Session.Delete(entity);
Session.Save(newentity);
Session.Flush();

On Flush NHibernate raise an exception with this message: "Could not synchronize database state with session" / "Violation of PRIMARY KEY"

It seems to have problem with Case Sensitive ID, if I use "AAA" on Id of "newentity" then it works, but in my situation is not so easy and I've to find an alternative solution.

I'm using NHibernate 2.1.2 and SQL Server 2005

How can avoid this exception? Can you help me?


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.