This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mirkorossini.transactionaltest; | |
import com.google.inject.*; | |
import org.apache.ibatis.session.SqlSessionManager; | |
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory; | |
import org.mybatis.guice.MyBatisModule; | |
import org.mybatis.guice.datasource.builtin.PooledDataSourceProvider; | |
import org.mybatis.guice.datasource.helper.JdbcHelper; | |
import org.mybatis.guice.transactional.Transactional; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testBindMapperPrivateModuleExposeSqlSessionManager() { | |
/** | |
*/ | |
final Module privateModule = new PrivateModule() { | |
@Override | |
protected void configure() { | |
final Module myBatisModule = new MyBatisModule() { | |
@Override | |
protected void initialize() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testBindMapperPrivateModuleExposedInterfaceExposeSqlSessionManager() { | |
/** | |
*/ | |
final Module privateModule = new PrivateModule() { | |
@Override | |
protected void configure() { | |
final Module myBatisModule = new MyBatisModule() { | |
@Override | |
protected void initialize() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testBindMapperPrivateModuleExposedInterface() { | |
/** | |
*/ | |
final Module privateModule = new PrivateModule() { | |
@Override | |
protected void configure() { | |
final Module myBatisModule = new MyBatisModule() { | |
@Override | |
protected void initialize() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testBindMapperPrivateModuleExposedService() { | |
/** | |
*/ | |
final Module privateModule = new PrivateModule() { | |
@Override | |
protected void configure() { | |
final Module myBatisModule = new MyBatisModule() { | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testBindMapperPrivateModule() { | |
final Module privateModule = new PrivateModule() { | |
@Override | |
protected void configure() { | |
final Module myBatisModule = new MyBatisModule() { | |
@Override | |
protected void initialize() { | |
environmentId(ENV); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testBindMapperPrivateMethod() { | |
/** | |
* Won't work: mybatis doesn't know about the service | |
*/ | |
final Module myBatisModule = new MyBatisModule() { | |
@Override | |
protected void initialize() { | |
environmentId(ENV); | |
install(JdbcHelper.H2_EMBEDDED); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testBindMapper() { | |
final Module myBatisModule = new MyBatisModule() { | |
@Override | |
protected void initialize() { | |
environmentId(ENV); | |
install(JdbcHelper.H2_EMBEDDED); | |
bindDataSourceProviderType(PooledDataSourceProvider.class); | |
bindTransactionFactoryType(JdbcTransactionFactory.class); | |
addMapperClass(DummyMapper.class); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mirkorossini.transactionaltest.services; | |
import com.mirkorossini.transactionaltest.mappers.DummyMapper; | |
import org.apache.ibatis.session.SqlSessionManager; | |
import org.mybatis.guice.transactional.Transactional; | |
import javax.inject.Inject; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mirkorossini.transactionaltest.services; | |
public interface DummyServiceInt { | |
void insertValue(int value); | |
} |
NewerOlder