ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manuel.Rae...@pruftechnik.com
Subject use dao and sqlmaps
Date Thu, 02 Feb 2006 09:11:52 GMT
Hello,

I will use dao with sqlmaps. I also want to configure more than one 
database connections. 
Therefore I add some contexts to the dao config (dao.xml) file.

<dao-config>

  <context id="DB_1">

    <transactionManager type="SQLMAP">
      <property name="SqlMapConfig" 
value="com/domain/dao/sqlmap/SqlMapConfig_1.xml"/>
    </transactionManager>

    <dao interface="com.domain.dao.OrderDao" 
implementation="com.domain.dao.jdbc.JdbcOrderDao"/>
    ...
  </context>

  <context id="DB_2">

    <transactionManager type="SQLMAP">
      <property name="SqlMapConfig" 
value="com/domain/dao/sqlmap/SqlMapConfig_2.xml"/>
    </transactionManager>

    <dao interface="com.domain.dao.OrderDao" 
implementation="com.domain.dao.jdbc.JdbcOrderDao"/>
    ...
  </context>

... // more contexts

</dao-config>


The sql map config file(s) looks like following:

<sql-map-config>

  <properties resource="conf/omt/sqlmap/SqlMapConfig.properties" />

  <transactionManager type="JDBC">
    <dataSource type="SIMPLE">
      <property value="${driver}" name="JDBC.Driver"/>
      <property value="${url}" name="JDBC.ConnectionURL"/>
      <property value="${username}" name="JDBC.Username"/>
      <property value="${password}" name="JDBC.Password"/>
    </dataSource>
  </transactionManager>

  <sql-map resource="conf/omt/sqlmap/TreeInfo.xml" />
  ...
</sql-map-config>


Is there a mechanism to use for all dao contexts the same sql map config 
file (configure the transaction manager - db url, driver, etc.- in the 
context in the dao config file)? 
Because the files are identically apart from the url or driver.
The advantage is that I had to create only one sql map config file and 
only one dao config file.

Best regards
Manuel R├Ądle
Mime
View raw message