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 2008/03/18 20:54:35 UTC

svn commit: r638542 - in /ibatis/trunk/cs/mapper2/Apache.Ibatis.DataMapper.SqlClient.Test.2005: Fixtures/Mapping/ConstructorTest.cs Maps/Account.xml

Author: gbayon
Date: Tue Mar 18 12:54:35 2008
New Revision: 638542

URL: http://svn.apache.org/viewvc?rev=638542&view=rev
Log:
Just a test to ensure that iBATIS V2 already resolved IBATISNET-260 

Modified:
    ibatis/trunk/cs/mapper2/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/ConstructorTest.cs
    ibatis/trunk/cs/mapper2/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Account.xml

Modified: ibatis/trunk/cs/mapper2/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/ConstructorTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper2/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/ConstructorTest.cs?rev=638542&r1=638541&r2=638542&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper2/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/ConstructorTest.cs (original)
+++ ibatis/trunk/cs/mapper2/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/ConstructorTest.cs Tue Mar 18 12:54:35 2008
@@ -39,6 +39,17 @@
 
         #region Tests
 
+        [Test]
+        [Category("JIRA")]
+        [Category("JIRA-260")]
+        public void Extend_ResultMap_with_Constructor_should_be_used()
+        {
+            Account account = dataMapper.QueryForObject<Account>("JIRA260", 1);
+            AssertAccount1(account);
+            Assert.IsTrue(account.BannerOption);
+            Assert.IsFalse(account.CartOption);
+        }
+
         /// <summary>
         /// Test account constructor mapping
         /// </summary>

Modified: ibatis/trunk/cs/mapper2/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Account.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper2/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Account.xml?rev=638542&r1=638541&r2=638542&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper2/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Account.xml (original)
+++ ibatis/trunk/cs/mapper2/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Account.xml Tue Mar 18 12:54:35 2008
@@ -39,6 +39,20 @@
       <result property="Name" column="Category_Name"/>
       <result property="Guid" column="Category_Guid" nullValue="00000000-0000-0000-0000-000000000000"/>
     </resultMap>
+
+    <resultMap id="account-constructor"  class="Account" >
+      <constructor>
+        <argument argumentName="identifiant"	column="Account_ID"/>
+        <argument argumentName="firstName"    column="Account_FirstName"/>
+        <argument argumentName="lastName"     column="Account_LastName"/>
+      </constructor>
+    </resultMap>
+
+    <resultMap id="account-extends-constructor"  class="Account"  extends="account-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-constructor"  class="Account" >
 			<constructor>
@@ -121,6 +135,12 @@
     -->
   <statements>
 
+    <select id="JIRA260" parameterClass="Integer" resultMap="account-extends-constructor">
+      select *
+      from Accounts
+      where Account_ID = #value#
+    </select>
+    
     <select id="SelectGenericList" parameterClass="Integer" resultMap="account-result-constructor" listClass="genericList">
       select * from Accounts
     </select>