Ibatis核心、映射 配置文件

核心配置文件:

----------------------------------------------------------

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE sqlMapConfig     

PUBLIC"-//ibatis.apache.org//DTDSQLMapConfig2.0//EN"

    "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

<sqlMapConfig>

  <!-- <properties resource="SqlMap.properties"/> -->

<!--Configureabuilt-intransactionmanager.Ifyou'reusingan

appserver,youprobablywanttouseitstransactionmanager

andamanageddatasource-->

<!--

<transactionManagertype="JDBC"commitRequired="false">

<dataSourcetype="SIMPLE">

<propertyname="JDBC.Driver"value="${driver}"/>

<propertyname="JDBC.ConnectionURL"value="${url}"/>

<propertyname="JDBC.Username"value="${username}"/>

<propertyname="JDBC.Password"value="${password}"/>

</dataSource>

</transactionManager>

-->

<!--ListtheSQLMapXMLfiles.Theycanbeloadedfromthe

classpath,astheyarehere(com.domain.data...)-->

<sqlMapresource="com/ibatis/model/Account.xml"/>

<!--Listmorehere...

<sqlMapresource="com/mydomain/data/Order.xml"/>

<sqlMapresource="com/mydomain/data/Documents.xml"/>

  -->

</sqlMapConfig>

----------------------------------------------------------

实体类的映射文件:

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE sqlMap     

PUBLIC"-//ibatis.apache.org//DTDSQLMap2.0//EN"

    "http://ibatis.apache.org/dtd/sql-map-2.dtd">

<sqlMap namespace="Account">

  <!-- Use type aliases to avoid typing the full classname every time. -->  <!-- <typeAlias alias="Account" type="com.ibatis.model.Account"/> -->

</sqlMap>

相关推荐