Class SqlSessionFactoryBean

java.lang.Object
org.mybatis.spring.SqlSessionFactoryBean
All Implemented Interfaces:
EventListener, org.springframework.beans.factory.FactoryBean<org.apache.ibatis.session.SqlSessionFactory>, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>

public class SqlSessionFactoryBean extends Object implements org.springframework.beans.factory.FactoryBean<org.apache.ibatis.session.SqlSessionFactory>, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
FactoryBean that creates a MyBatis SqlSessionFactory. This is the usual way to set up a shared MyBatis SqlSessionFactory in a Spring application context; the SqlSessionFactory can then be passed to MyBatis-based DAOs via dependency injection.

Either DataSourceTransactionManager or JtaTransactionManager can be used for transaction demarcation in combination with a SqlSessionFactory. JTA should be used for transactions which span multiple databases or when container managed transactions (CMT) are being used.

Author:
Putthiphong Boonphong, Hunter Presnall, Eduardo Macarron, EddĂș MelĂ©ndez, Kazuki Shimizu, Jens Schauder
See Also: