You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by gb...@apache.org on 2006/10/09 20:46:26 UTC
svn commit: r454454 - in /ibatis/trunk/cs/mapper:
IBatisNet.DataMapper.Test/Domain/
IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/
IBatisNet.DataMapper.Test/NUnit/SqlMapTests/
IBatisNet.DataMapper.Test/bin/Debug/
IBatisNet.DataMapper/MappedStatements/...
Author: gbayon
Date: Mon Oct 9 11:46:25 2006
New Revision: 454454
URL: http://svn.apache.org/viewvc?view=rev&rev=454454
Log:
Fix IBATISNET-186
Forget to use the argumentStrategy
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Account.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Document.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConstructorTest.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/IBatisNet.DataMapper.Test.dll.config
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/ResultMapStrategy.cs
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Account.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Account.cs?view=diff&rev=454454&r1=454453&r2=454454
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Account.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Account.cs Mon Oct 9 11:46:25 2006
@@ -27,6 +27,14 @@
_lastName = lastName;
}
+ public Account(int identifiant, string firstName, string lastName, Document document)
+ {
+ id = identifiant;
+ _firstName = firstName;
+ _lastName = lastName;
+ _document = document;
+ }
+
public int Id
{
get { return id; }
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml?view=diff&rev=454454&r1=454453&r2=454454
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml Mon Oct 9 11:46:25 2006
@@ -84,6 +84,18 @@
<result property="BannerOption" column="Account_Banner_Option" dbType="Varchar" type="bool"/>
<result property="CartOption" column="Account_Cart_Option" typeHandler="HundredsBool"/>
</resultMap>
+
+ <resultMap id="account-result-constructor2" class="Account" >
+ <constructor>
+ <argument argumentName="identifiant" column="Account_ID"/>
+ <argument argumentName="firstName" column="Account_FirstName"/>
+ <argument argumentName="lastName" column="Account_LastName"/>
+ <argument argumentName="document" column="Id=Account_ID" select="SelectDocument" />
+ </constructor>
+ <result property="EmailAddress" column="Account_Email" nullValue="no_email@provided.com"/>
+ <result property="BannerOption" column="Account_Banner_Option" dbType="Varchar" type="bool"/>
+ <result property="CartOption" column="Account_Cart_Option" typeHandler="HundredsBool"/>
+ </resultMap>
<resultMap id="account-result" class="Account" >
<result property="id" column="Account_ID"/>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Document.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Document.xml?view=diff&rev=454454&r1=454453&r2=454454
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Document.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Document.xml Mon Oct 9 11:46:25 2006
@@ -48,7 +48,14 @@
from Documents
order by Document_Type, Document_Id
</select>
-
+
+ <select id="SelectDocument" resultMap="document">
+ select
+ *
+ from Documents
+ Where Account_ID = #Id#
+ </select>
+
<select id="GetTypedCollection"
listClass="DocumentCollection"
resultMap="document">
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml?view=diff&rev=454454&r1=454453&r2=454454
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml Mon Oct 9 11:46:25 2006
@@ -135,8 +135,23 @@
<result property="City" column="Order_City"/>
<result property="Province" column="Order_Province"/>
<result property="PostalCode" column="Order_PostalCode"/>
- </resultMap>
-
+ </resultMap>
+
+ <resultMap id="order-result-constructor9" class="Order" >
+ <constructor>
+ <argument argumentName="id" column="Order_ID"/>
+ <argument argumentName="account" resultMapping="Account.account-result-constructor2" />
+ </constructor>
+ <result property="Date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ </resultMap>
+
<resultMap id="credit-card-result" class="string">
<result property="value" column="Order_CardNumber"/>
</resultMap>
@@ -767,13 +782,39 @@
LEFT OUTER JOIN Accounts as acc on acc.Account_ID = ord.Account_ID
where Order_ID = #value#
</select>
+
+
<select id="GetOrderConstructor9"
extends="GetOrderConstructor8"
parameterClass="Integer"
resultMap="order-joined-with-account-constructor">
</select>
-
+
+ <select id="GetOrderConstructor10"
+ parameterClass="Integer"
+ resultMap="order-result-constructor9">
+ select
+ Order_ID,
+ Order_Date,
+ Order_CardExpiry,
+ Order_CardType,
+ Order_CardNumber,
+ Order_Street,
+ Order_City,
+ Order_Province,
+ Order_PostalCode,
+ acc.Account_ID,
+ acc.Account_FirstName,
+ acc.Account_LastName,
+ acc.Account_Email,
+ acc.Account_Banner_Option,
+ acc.Account_Cart_Option
+ from Orders as ord
+ LEFT OUTER JOIN Accounts as acc on acc.Account_ID = ord.Account_ID
+ where Order_ID = #value#
+ </select>
+
</statements>
<parameterMaps>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs?view=diff&rev=454454&r1=454453&r2=454454
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs Mon Oct 9 11:46:25 2006
@@ -83,8 +83,14 @@
}
catch(Exception ex)
{
- Console.WriteLine(ex.Message);
- Console.WriteLine(ex.StackTrace.ToString());
+ Exception e = ex;
+ while (e != null)
+ {
+ Console.WriteLine(e.Message);
+ Console.WriteLine(e.StackTrace.ToString());
+ e = e.InnerException;
+
+ }
throw;
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConstructorTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConstructorTest.cs?view=diff&rev=454454&r1=454453&r2=454454
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConstructorTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConstructorTest.cs Mon Oct 9 11:46:25 2006
@@ -162,7 +162,22 @@
Assert.IsTrue(order.Id == 11);
Assert.IsNull(order.Account);
}
-
+
+ /// <summary>
+ /// Test resultMap with a result property using another resultMap and where
+ /// - the result property resultMap use a constructor
+ /// - all the constructor arguments are null.
+ /// </remarks>
+ [Test]
+ public void TestJIRAXXX()
+ {
+ Order order = sqlMap.QueryForObject("GetOrderConstructor10", 5) as Order;
+
+ Assert.IsTrue(order.Id == 5);
+ Assert.IsNotNull(order.Account);
+ Assert.IsNotNull(order.Account.Document);
+ }
+
/// <summary>
/// Test constructor with select attribute on argument
/// </remarks>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/IBatisNet.DataMapper.Test.dll.config
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/IBatisNet.DataMapper.Test.dll.config?view=diff&rev=454454&r1=454453&r2=454454
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/IBatisNet.DataMapper.Test.dll.config (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/IBatisNet.DataMapper.Test.dll.config Mon Oct 9 11:46:25 2006
@@ -30,14 +30,14 @@
<iBATIS>
<logging>
-<!--
+
<logFactoryAdapter type="IBatisNet.Common.Logging.Impl.ConsoleOutLoggerFA, IBatisNet.Common">
<arg key="showLogName" value="true" />
<arg key="showDataTime" value="true" />
<arg key="level" value="ALL" />
<arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:SSS" />
</logFactoryAdapter>
-
+<!--
<logFactoryAdapter type="IBatisNet.Common.Logging.Impl.Log4NetLoggerFA, IBatisNet.Common.Logging.Log4Net">
<arg key="configType" value="inline" />
</logFactoryAdapter>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/ResultMapStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/ResultMapStrategy.cs?view=diff&rev=454454&r1=454453&r2=454454
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/ResultMapStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/ResultMapStrategy.cs Mon Oct 9 11:46:25 2006
@@ -60,7 +60,7 @@
for (int index = 0; index < resultMapping.Parameters.Count; index++)
{
ResultProperty property = resultMapping.Parameters[index];
- parameters[index] = property.GetDataBaseValue( reader );
+ parameters[index] = property.ArgumentStrategy.GetValue(request, property, ref reader, null);
request.IsRowDataFound = request.IsRowDataFound || (parameters[index] != null);
isParameterFound = isParameterFound || (parameters[index] != null);
}