Search in sources :

Example 1 with MybatisSqlSessionFactoryBuilder

use of com.baomidou.mybatisplus.core.MybatisSqlSessionFactoryBuilder in project mybatis-plus-samples by baomidou.

the class NoSpring method initSqlSessionFactory.

public static SqlSessionFactory initSqlSessionFactory() {
    DataSource dataSource = dataSource();
    TransactionFactory transactionFactory = new JdbcTransactionFactory();
    Environment environment = new Environment("Production", transactionFactory, dataSource);
    MybatisConfiguration configuration = new MybatisConfiguration(environment);
    configuration.addMapper(PersonMapper.class);
    configuration.setLogImpl(StdOutImpl.class);
    return new MybatisSqlSessionFactoryBuilder().build(configuration);
}
Also used : MybatisSqlSessionFactoryBuilder(com.baomidou.mybatisplus.core.MybatisSqlSessionFactoryBuilder) MybatisConfiguration(com.baomidou.mybatisplus.core.MybatisConfiguration) TransactionFactory(org.apache.ibatis.transaction.TransactionFactory) JdbcTransactionFactory(org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory) Environment(org.apache.ibatis.mapping.Environment) JdbcTransactionFactory(org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory) DataSource(javax.sql.DataSource) SimpleDriverDataSource(org.springframework.jdbc.datasource.SimpleDriverDataSource)

Aggregations

MybatisConfiguration (com.baomidou.mybatisplus.core.MybatisConfiguration)1 MybatisSqlSessionFactoryBuilder (com.baomidou.mybatisplus.core.MybatisSqlSessionFactoryBuilder)1 DataSource (javax.sql.DataSource)1 Environment (org.apache.ibatis.mapping.Environment)1 TransactionFactory (org.apache.ibatis.transaction.TransactionFactory)1 JdbcTransactionFactory (org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory)1 SimpleDriverDataSource (org.springframework.jdbc.datasource.SimpleDriverDataSource)1