Package net.sourceforge.hivetranse.transaction.ibatis

This is the main package for iBATIS SqlMaps usage under HiveTranse.

See:
          Description

Class Summary
AbstractEnumTypeHandler  
AbstractSqlMapClientDAO  
SqlMapClientFactory This service creates Proxys to iBATIS SqlMapClient (V2).
SqlMapClientFactoryContribution Represents a configuration parameter to the SqlMapClientFactory configured for building a SqlMapClient service.
 

Package net.sourceforge.hivetranse.transaction.ibatis Description

This is the main package for iBATIS SqlMaps usage under HiveTranse.

It reuses the JdbcTransactionService from hivetranse.jdbc module.
It simply implements the necessary service to directly construct and inject SqlMapClient into the application services.
It is possible to define more than one SqlMapClient at a time (each using a different Connection ie a different Database.
This package only supports iBATIS SqlMaps V2.

SqlMapClient service

To declare a SqlMapClient service, you first must declare a JDBC Connections service, as described in hivetranse.jdbc module documentation.
We suppose such a Connection has been defined and will be named MyConnection in the following examples.
Configuring such a service can be done as the example below shows:
        <service-point id="MySqlMapClient" interface="com.ibatis.sqlmap.client.SqlMapClient">
                <invoke-factory      service-id="hivetranse.ibatis.SqlMapClientFactory" model="singleton">
                        <sqlmap config="sqlmap-config.xml" connection="MyConnection"/>
                </invoke-factory>
        </service-point>
The service must use the singleton service model.
In the previous example, the file sqlmaps-config.xml contains all iBATIS SqlMaps configuration settings including the references to all mapping files. This file should not contain any setting for <transactionManager> as this will be taken care of by HiveTranse.
It is advised to eager-load the SqlMapClient service through HiveMind EagerLoad configuration point, so that the configuration file will be parsed early instead of reducing performance of first user request. This can be done with the following declaration in hivemodule.xml:
        <contribution configuration-id="hivemind.EagerLoad">
                <load service-id="MySqlMapClient"/>
        </contribution>
Such a SqlMapClient service can then be injected in your services that need it. Those services just need to use the injected SqlMapClient in a usual way, as if it had been obtained directly from a call to iBATIS SqlMapClientBuilder class.
Please note that your services code should not contain any call to SqlMapClient methods related to transaction handling.