-->
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.  [ 4 posts ] 
Author Message
 Post subject: about session.transaction.rollback
PostPosted: Fri Sep 30, 2005 12:27 am 
I will session.Saveorupdate(Entity).
example:
Code:
[Test]
[ExpectedException(typeof(ServiceExceptionUserAlreadyExisted))]
public void AddUserWithAnExistedLoginInfo()
{
   IDAL dal = new DALImpl();

   Person perEntity = new Person();
   perEntity.Name = "TestPerson";

   LoginInfo logifo = new LoginInfo();

                //loginname Field is unique="true" in the database
   logifo.LoginName = "admin";
   logifo.Password = "123";

                //one- to -one
   perEntity.TheLoginInfo = logifo;
   logifo.ThePerson = perEntity;

   dal.SaveEntity(perEntity);
}


because "admin" is exist in the Database. so session.transaction.commit is throw exception:
Code:
InnerException = {"Violation of UNIQUE KEY constraint 'UQ__TLoginInfo__38E54BF0'. Cannot insert duplicate key in object 'TLoginInfo'.\r\nThe statement has been terminated."}

And session.transaction.rollback(), but rollback shall again throw exception:
Code:
{"Object reference not set to an instance of an object."}


Why???


Top
  
 
 Post subject:
PostPosted: Fri Sep 30, 2005 2:35 am 
Newbie

Joined: Sun Sep 18, 2005 3:44 pm
Posts: 9
Same problem here.

after [NH-380] - "Error with query after comitted transaction" has been fixed in rc2, transaction rollback fails.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 30, 2005 3:39 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Yes, I know about that one, it should be fixed in upcoming rc3. Sorry about that.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 30, 2005 4:44 am 
Newbie

Joined: Sun Sep 18, 2005 3:44 pm
Posts: 9
Sergey, nothing to be sorry about. Even with this bug and probably other(s), NHibernate is amazing.
Thanks to all involved in this project.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.