Author: gbayon
Date: Mon Dec 10 10:25:11 2007
New Revision: 602985
URL: http://svn.apache.org/viewvc?rev=602985&view=rev
Log:
Fix IBATISNET-242
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheTest.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/CachingStatement.cs
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheTest.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheTest.cs?rev=602985&r1=602984&r2=602985&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheTest.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheTest.cs
Mon Dec 10 10:25:11 2007
@@ -80,6 +80,24 @@
Assert.AreEqual(firstId, secondId);
}
+ /// <summary>
+ /// Cache error with QueryForObjectwith object in cache
+ /// </summary>
+ [Test]
+ public void TestJIRA242_WithoutGeneric_WithCache()
+ {
+ Account account1 = sqlMap.QueryForObject("GetNoAccountWithCache",
1) as Account;
+ AssertAccount1(account1);
+ int firstId = HashCodeProvider.GetIdentityHashCode(account1);
+
+ Account account2 = sqlMap.QueryForObject("GetNoAccountWithCache",
1) as Account;
+ AssertAccount1(account2);
+
+ int secondId = HashCodeProvider.GetIdentityHashCode(account2);
+
+ Assert.AreEqual(firstId, secondId);
+ }
+
/// <summary>
/// Test Cache query
/// </summary>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/CachingStatement.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/CachingStatement.cs?rev=602985&r1=602984&r2=602985&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/CachingStatement.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/CachingStatement.cs
Mon Dec 10 10:25:11 2007
@@ -369,7 +369,7 @@
// convert the marker object back into a null
value
obj = null;
}
- else
+ else if(obj == null)
{
obj =
_mappedStatement.RunQueryForObject(request, session, parameterObject,
resultObject);
this.Statement.CacheModel[cacheKey] = obj;
@@ -421,7 +421,7 @@
// convert the marker object back into a null value
obj = default(T);
}
- else //if ((object)obj == null)
+ else
{
obj = (T)_mappedStatement.RunQueryForObject(request, session,
parameterObject, resultObject);
this.Statement.CacheModel[cacheKey] = obj;