|
From: NHibernate J. <nh...@gm...> - 2010-02-02 22:39:43
|
Entity version updated when no update necessary.
------------------------------------------------
Key: NH-2100
URL: http://nhjira.koah.net/browse/NH-2100
Project: NHibernate
Issue Type: Bug
Components: Core
Affects Versions: 2.1.2.GA
Reporter: Luke Bakken
Priority: Major
Attachments: NH.zip
I have a test case with two classes in a many-to-many relationship. Tests One and Two show failing cases where I would expect the version to not change, test Three shows a case where opening an entirely different session has the expected results.
Stepping through the NH source I can see that in the failing cases the PersistentBag associated with Class2List in Class1 does not have a populated Snapshot - this is why NH forces the collection to be dirty when the transaction ends. I would expect that adding items to a collection, calling Save() and then Commit() would update the Snapshot collection correctly in this case so a second Session is not necessary.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://nhjira.koah.net/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|
|
From: NHibernate J. <nh...@gm...> - 2010-02-03 00:09:44
|
[ http://nhjira.koah.net/browse/NH-2100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19076#action_19076 ]
Luke Bakken commented on NH-2100:
---------------------------------
The following test runs correctly, so I must not understand the use of multiple transactions within an ISession, or if using multiple transactions within an ISession is even supported. I apologize for the extraneous JIRA.
Class1 c1;
Class2 c2;
Class1DTO dto;
using (ISession s = _sessions.OpenSession())
{
using (ITransaction tx = s.BeginTransaction())
{
c1 = new Class1();
c2 = new Class2();
c1.AddClass2(c2);
s.Save(c2);
s.Save(c1);
dto = new Class1DTO { ID = c1.ID, EntityVersion = c1.EntityVersion };
tx.Commit();
}
Assert.AreEqual(1, c1.EntityVersion);
Assert.AreEqual(1, c2.EntityVersion);
Assert.AreEqual(c1.ID, dto.ID);
Assert.AreEqual(1, dto.EntityVersion);
}
Assert.AreEqual(1, c1.EntityVersion);
Assert.AreEqual(1, c2.EntityVersion);
Assert.AreEqual(c1.ID, dto.ID);
Assert.AreEqual(1, dto.EntityVersion);
> Entity version updated when no update necessary.
> ------------------------------------------------
>
> Key: NH-2100
> URL: http://nhjira.koah.net/browse/NH-2100
> Project: NHibernate
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.1.2.GA
> Reporter: Luke Bakken
> Priority: Major
> Attachments: NH.zip
>
>
> I have a test case with two classes in a many-to-many relationship. Tests One and Two show failing cases where I would expect the version to not change, test Three shows a case where opening an entirely different session has the expected results.
> Stepping through the NH source I can see that in the failing cases the PersistentBag associated with Class2List in Class1 does not have a populated Snapshot - this is why NH forces the collection to be dirty when the transaction ends. I would expect that adding items to a collection, calling Save() and then Commit() would update the Snapshot collection correctly in this case so a second Session is not necessary.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://nhjira.koah.net/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|
|
From: NHibernate J. <nh...@gm...> - 2010-02-03 15:58:30
|
[ http://nhjira.koah.net/browse/NH-2100?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Luke Bakken updated NH-2100:
----------------------------
Attachment: NH.zip
This set of tests contains examples of how calls to Refresh() in the second transaction can fix this issue.
> Entity version updated when no update necessary.
> ------------------------------------------------
>
> Key: NH-2100
> URL: http://nhjira.koah.net/browse/NH-2100
> Project: NHibernate
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.1.2.GA
> Reporter: Luke Bakken
> Priority: Major
> Attachments: NH.zip, NH.zip
>
>
> I have a test case with two classes in a many-to-many relationship. Tests One and Two show failing cases where I would expect the version to not change, test Three shows a case where opening an entirely different session has the expected results.
> Stepping through the NH source I can see that in the failing cases the PersistentBag associated with Class2List in Class1 does not have a populated Snapshot - this is why NH forces the collection to be dirty when the transaction ends. I would expect that adding items to a collection, calling Save() and then Commit() would update the Snapshot collection correctly in this case so a second Session is not necessary.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://nhjira.koah.net/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|
|
From: Fabio M. (JIRA) <nh...@gm...> - 2011-05-09 22:20:51
|
[ http://216.121.112.228/browse/NH-2100?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fabio Maulo closed NH-2100.
---------------------------
Resolution: Obsolete
Even without the Refresh (that mean another hit to DB) the test does not fail in NH3.2
> Entity version updated when no update necessary.
> ------------------------------------------------
>
> Key: NH-2100
> URL: http://216.121.112.228/browse/NH-2100
> Project: NHibernate
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.1.2.GA
> Reporter: Luke Bakken
> Priority: Major
> Attachments: NH.zip, NH.zip
>
>
> I have a test case with two classes in a many-to-many relationship. Tests One and Two show failing cases where I would expect the version to not change, test Three shows a case where opening an entirely different session has the expected results.
> Stepping through the NH source I can see that in the failing cases the PersistentBag associated with Class2List in Class1 does not have a populated Snapshot - this is why NH forces the collection to be dirty when the transaction ends. I would expect that adding items to a collection, calling Save() and then Commit() would update the Snapshot collection correctly in this case so a second Session is not necessary.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|