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/06/28 20:44:01 UTC
svn commit: r417839 - in /ibatis/trunk/cs/docs:
dataAccessGuide/src/en/dao.xml dataAccessGuide/src/en/interface.xml
dataAccessGuide/src/en/programming.xml dataMapperGuide/src/en/working.xml
Author: gbayon
Date: Wed Jun 28 11:44:01 2006
New Revision: 417839
URL: http://svn.apache.org/viewvc?rev=417839&view=rev
Log:
- Updated docs
Modified:
ibatis/trunk/cs/docs/dataAccessGuide/src/en/dao.xml
ibatis/trunk/cs/docs/dataAccessGuide/src/en/interface.xml
ibatis/trunk/cs/docs/dataAccessGuide/src/en/programming.xml
ibatis/trunk/cs/docs/dataMapperGuide/src/en/working.xml
Modified: ibatis/trunk/cs/docs/dataAccessGuide/src/en/dao.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/docs/dataAccessGuide/src/en/dao.xml?rev=417839&r1=417838&r2=417839&view=diff
==============================================================================
--- ibatis/trunk/cs/docs/dataAccessGuide/src/en/dao.xml (original)
+++ ibatis/trunk/cs/docs/dataAccessGuide/src/en/dao.xml Wed Jun 28 11:44:01 2006
@@ -50,12 +50,19 @@
</thead>
<tbody>
- <row>
- <entry>DaoManager (Facade)</entry>
+
+ <row>
+
+ <entry>DomDaoManagerBuilder</entry>
<entry>Responsible for configuration of the DAO framework (via
- dao.config), instantiating DAO implementations, and acting as a
- façade to the rest of the API.</entry>
+ dao.config), instantiating DAO implementations and IDaoManager instances.</entry>
+ </row>
+
+ <row>
+ <entry>IDaoManager (Facade)</entry>
+
+ <entry>Acting as a façade to the rest of the API.</entry>
</row>
<row>
Modified: ibatis/trunk/cs/docs/dataAccessGuide/src/en/interface.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/docs/dataAccessGuide/src/en/interface.xml?rev=417839&r1=417838&r2=417839&view=diff
==============================================================================
--- ibatis/trunk/cs/docs/dataAccessGuide/src/en/interface.xml (original)
+++ ibatis/trunk/cs/docs/dataAccessGuide/src/en/interface.xml Wed Jun 28 11:44:01 2006
@@ -88,7 +88,7 @@
namespace IBatisNet.Test.Implementations {
public class <emphasis role="blue">BaseDao: IDao</emphasis> {
<emphasis role="blue">protected DaoSession GetContext()</emphasis> {
- DaoManager daoManager = DaoManager.GetInstance(this);
+ IDaoManager daoManager = DaoManager.GetInstance(this);
return (daoManager.LocalDaoSession as DaoSession);
}
}
@@ -339,7 +339,7 @@
public class AccountService {
- protected static DaoManager daoManager = null;
+ protected static IDaoManager daoManager = null;
static AccountService() {
daoManager = DaoManager.GetInstance();
Modified: ibatis/trunk/cs/docs/dataAccessGuide/src/en/programming.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/docs/dataAccessGuide/src/en/programming.xml?rev=417839&r1=417838&r2=417839&view=diff
==============================================================================
--- ibatis/trunk/cs/docs/dataAccessGuide/src/en/programming.xml (original)
+++ ibatis/trunk/cs/docs/dataAccessGuide/src/en/programming.xml Wed Jun 28 11:44:01 2006
@@ -72,7 +72,7 @@
<programlisting>DomDaoManagerBuilder builder = new DomDaoManagerBuilder();
builder.Configure();
-DaoManager daoManager = DaoManager.GetInstance("SqlMapDaoContext");</programlisting>
+IDaoManager daoManager = DaoManager.GetInstance("SqlMapDaoContext");</programlisting>
</example>
<para>If you have named your configuration file something other than
@@ -89,7 +89,7 @@
or an absolute file path such as "file://c:\dir\a.config" */
</emphasis>DomDaoManagerBuilder builder = new DomDaoManagerBuilder();
builder.Configure(strPath);
-DaoManager daoManager = DaoManager.GetInstance("AnotherContext");</programlisting>
+IDaoManager daoManager = DaoManager.GetInstance("AnotherContext");</programlisting>
</example>
<tip>
@@ -115,13 +115,13 @@
FileInfo aFileInfo = someSupportClass.GetDynamicFileInfo();
DomDaoManagerBuilder builder = new DomDaoManagerBuilder();
builder.Configure(aFileInfo);
-DaoManager daoManager = DaoManager.GetInstance("NHibernateContext");
+IDaoManager daoManager = DaoManager.GetInstance("NHibernateContext");
<emphasis role="comment">/* Configure through a Uri. */</emphasis>
Uri aUri = someSupportClass.GetDynamicUri();
DomDaoManagerBuilder builder = new DomDaoManagerBuilder();
builder.Configure(aUri);
-DaoManager daoManager = DaoManager.GetInstance("SimpleDao");</programlisting>
+IDaoManager daoManager = DaoManager.GetInstance("SimpleDao");</programlisting>
</example>
<para>If you find that you already have loaded your DAO configuration
@@ -138,13 +138,13 @@
XmlDocument anXmlDoc = someSupportClass.GetDynamicXmlDocument();
DomDaoManagerBuilder builder = new DomDaoManagerBuilder();
builder.Configure(anXmlDoc);
-DaoManager daoManager = DaoManager.GetInstance("Petstore");
+IDaoManager daoManager = DaoManager.GetInstance("Petstore");
<emphasis role="comment">/* Configure from a stream. */</emphasis>
Stream aStream = someSupportClass.GetDynamicStream();
DomDaoManagerBuilder builder = new DomDaoManagerBuilder();
builder.Configure(aStream);
-DaoManager daoManager = DaoManager.GetInstance("AnotherPetstore");</programlisting>
+IDaoManager daoManager = DaoManager.GetInstance("AnotherPetstore");</programlisting>
</example>
<para>In addition to the straightforward
@@ -212,7 +212,7 @@
method <literal>DaoManager[type]</literal>) For example:</para>
<programlisting>[C#]
-DaoManager daoManager = DaoManager.GetInstance("daoContextName");
+IDaoManager daoManager = DaoManager.GetInstance("daoContextName");
<emphasis role="comment">// gets the dao of type 'ICategoryDao'</emphasis>
ICategoryDao categoryDao = daoManager.GetDao(typeof(ICategoryDao)) as ICategoryDao;
<emphasis role="comment">// same thing, just using the indexer</emphasis>
@@ -237,7 +237,7 @@
c1.Add(p1);
c2.Add(p2);
-DaoManager daoManager = DaoManager.GetInstance("PetStore");
+IDaoManager daoManager = DaoManager.GetInstance("PetStore");
ICategoryDao categoryDao = daoManager[typeof(ICategoryDao)] as ICategoryDao;
IProductDao productDao = daoManager[typeof(IProductDao)] as IProductDao;
@@ -271,7 +271,7 @@
the <methodname>using</methodname> syntax as in the examples below.</para>
<para><programlisting>[C#]
-DaoManager daoManager = DaoManager.GetInstance("PetStore");
+IDaoManager daoManager = DaoManager.GetInstance("PetStore");
IAccountDao accountDao = daoManager[typeof(IAccountDao)] as IAccountDao;
using ( IDalSession session = daoManager.OpenConnection() )
Modified: ibatis/trunk/cs/docs/dataMapperGuide/src/en/working.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/docs/dataMapperGuide/src/en/working.xml?rev=417839&r1=417838&r2=417839&view=diff
==============================================================================
--- ibatis/trunk/cs/docs/dataMapperGuide/src/en/working.xml (original)
+++ ibatis/trunk/cs/docs/dataMapperGuide/src/en/working.xml Wed Jun 28 11:44:01 2006
@@ -1403,6 +1403,18 @@
[class="<emphasis role="blue">fullyQualifiedClassName, assembly|typeAlias</emphasis>"]
[extends="<emphasis role="blue">[sqlMapNamespace.]resultMapId</emphasis>"]>
+ <constructor >
+ <argument property="<emphasis role="blue">argumentName</emphasis>"
+ column="<emphasis role="blue">columnName</emphasis>"
+ [columnIndex="<emphasis role="blue">columnIndex</emphasis>"]
+ [dbType="<emphasis role="blue">databaseType</emphasis>"]
+ [type="<emphasis role="blue">propertyCLRType</emphasis>"]
+ [resultMapping="<emphasis role="blue">resultMapName</emphasis>"]
+ [nullValue="<emphasis role="blue">nullValueReplacement</emphasis>"]
+ [select="<emphasis role="blue">someOtherStatementName</emphasis>"]
+ [typeHandler="<emphasis role="blue">fullyQualifiedClassName, assembly|typeAlias</emphasis>"] />
+ </constructor >
+
<result property="<emphasis role="blue">propertyName</emphasis>"
column="<emphasis role="blue">columnName</emphasis>"
[columnIndex="<emphasis role="blue">columnIndex</emphasis>"]
@@ -1494,6 +1506,139 @@
</sect3>
</sect2>
+ <sect2>
+ <title><constructor> element</title>
+
+ <para>The <constructor> element must match the signature of one of the result class constructor. If specify, this element is used by iBATIS to instanciate the result object.</para>
+
+ <para>The <constructor> element holds one or more <argument>
+ child elements that map SQL resultsets to object argument constructor.</para>
+
+ <para>
+ <example>
+ <title>Constructor element example</title>
+
+ <programlisting><resultMap id="account-result-constructor" class="Account" >
+ <emphasis role="blue"><constructor>
+ <argument argumentName="id" column="Account_ID"/>
+ <argument argumentName="firstName" column="Account_FirstName"/>
+ <argument argumentName="lastName" column="Account_LastName"/>
+ </constructor></emphasis>
+ <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></programlisting>
+ </example>
+ </para>
+
+ <sect3>
+ <title>argumentName</title>
+
+ <para>The <parameter>argumentName</parameter> attribute is the name of a
+ constructor argument of the result object that will be returned by the Mapped
+ Statement.</para>
+ </sect3>
+
+ <sect3>
+ <title>column</title>
+
+ <para>The <parameter>column</parameter> attribute value is the name of
+ the column in the result set from which the value will be used to
+ populate the argument.</para>
+ </sect3>
+
+ <sect3>
+ <title>columnIndex</title>
+
+ <para>As an optional (minimal) performance enhancement, the
+ <parameter>columnIndex</parameter> attribute value is the index of the
+ column in the ResultSet from which the value will be used to populate
+ the object argument. This is not likely needed in 99% of applications
+ and sacrifices maintainability and readability for speed. Some
+ providers may not realize any performance benefit, while others will
+ speed up dramatically.</para>
+ </sect3>
+
+ <sect3>
+ <title>dbType</title>
+
+ <para>The dbType attribute is used to explicitly specify the database
+ column type of the ResultSet column that will be used to populate the
+ argument. Although Result Maps do not have the same
+ difficulties with null values, specifying the type can be useful for
+ certain mapping types such as Date properties. Because an application
+ language has one Date value type and SQL databases may have many
+ (usually at least 3), specifying the date may become necessary in some
+ cases to ensure that dates (or other types) are set correctly.
+ Similarly, String types may be populated by a VarChar, Char or CLOB,
+ so specifying the type might be needed in those cases too.</para>
+ </sect3>
+
+ <sect3>
+ <title>type</title>
+
+ <para>The type attribute is used to explicitly specify the CLR
+ argument type. Normally this can be derived
+ from a argument through reflection, but certain mappings that use
+ objects such as a Map cannot provide the type to the framework. If the
+ attribute type is not set and the framework cannot otherwise determine
+ the type, the type is assumed to be Object. Section 6 details the CLR
+ types and available aliases that are supported by the
+ framework.</para>
+ </sect3>
+
+ <sect3>
+ <title>resultMapping</title>
+
+ <para>The <parameter>resultMapping</parameter> attribute can be set to
+ the name of another resultMap used to fill the argument. If the
+ resultMap is in an other mapping file, you must specified the fully
+ qualified name.</para>
+ </sect3>
+
+ <sect3>
+ <title>nullValue</title>
+
+ <para>The <parameter>nullValue</parameter> attribute can be set to any
+ valid value (based on argument type). The result element's
+ <parameter>nullValue</parameter> attribute is used to specify an
+ inbound null value replacement. What this means is that when the value
+ is detected in a query's result column, the corresponding object
+ argument will be set to the the <parameter>nullValue</parameter>
+ attribute's value. This allows you to use a "magic" null number in
+ your application for types that do not support null values (such as
+ <classname>int</classname>, <classname>double</classname>,
+ <classname>float</classname>).</para>
+
+ </sect3>
+
+ <sect3>
+ <title>select</title>
+
+ <para>The select attribute is used to describe a relationship between
+ objects and to automatically load complex (i.e. user defined) property
+ types. The value of the statement property must be the name of another
+ mapped statement. The value of the database column (the column
+ attribute) that is defined in the same property element as this
+ statement attribute will be passed to the related mapped statement as
+ the parameter. More information about supported primitive types and
+ complex property mappings/relationships is discussed later in this
+ document. The lazyLoad attribute can be specified with the
+ select</para>
+ </sect3>
+
+ <sect3>
+ <title>typeHandler</title>
+
+ <para>The typeHandler attribute allows the use of a Custom Type
+ Handler (see the Custom Type Handler section). This allows you to
+ extend the DataMapper's capabilities in handling types that are
+ specific to your database provider, are not handled by your database
+ provider, or just happen to be a part of your application design. You
+ can create custom type handlers to deal with storing and retrieving
+ booleans and Guids from your database for example.</para>
+ </sect3>
+ </sect2>
<sect2>
<title><result> Elements</title>