Java Code Examples for org.apache.ibatis.session.Configuration#setLazyLoadingEnabled()

The following examples show how to use org.apache.ibatis.session.Configuration#setLazyLoadingEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseExecutorTest.java    From mybatis with Apache License 2.0 7 votes vote down vote up
public BaseExecutorTest() {
  config = new Configuration();
  config.setLazyLoadingEnabled(true);
  config.setUseGeneratedKeys(false);
  config.setMultipleResultSetsEnabled(true);
  config.setUseColumnLabel(true);
  config.setDefaultStatementTimeout(5000);
}
 
Example 2
Source File: BindingTest.java    From mybaties with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setup() throws Exception {
  DataSource dataSource = BaseDataTest.createBlogDataSource();
  BaseDataTest.runScript(dataSource, BaseDataTest.BLOG_DDL);
  BaseDataTest.runScript(dataSource, BaseDataTest.BLOG_DATA);
  TransactionFactory transactionFactory = new JdbcTransactionFactory();
  Environment environment = new Environment("Production", transactionFactory, dataSource);
  Configuration configuration = new Configuration(environment);
  configuration.setLazyLoadingEnabled(true);
  configuration.getTypeAliasRegistry().registerAlias(Blog.class);
  configuration.getTypeAliasRegistry().registerAlias(Post.class);
  configuration.getTypeAliasRegistry().registerAlias(Author.class);
  configuration.addMapper(BoundBlogMapper.class);
  configuration.addMapper(BoundAuthorMapper.class);
  sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
}
 
Example 3
Source File: BindingTest.java    From mybatis with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setup() throws Exception {
  DataSource dataSource = BaseDataTest.createBlogDataSource();
  BaseDataTest.runScript(dataSource, BaseDataTest.BLOG_DDL);
  BaseDataTest.runScript(dataSource, BaseDataTest.BLOG_DATA);
  TransactionFactory transactionFactory = new JdbcTransactionFactory();
  Environment environment = new Environment("Production", transactionFactory, dataSource);
  Configuration configuration = new Configuration(environment);
  configuration.setLazyLoadingEnabled(true);
  configuration.getTypeAliasRegistry().registerAlias(Blog.class);
  configuration.getTypeAliasRegistry().registerAlias(Post.class);
  configuration.getTypeAliasRegistry().registerAlias(Author.class);
  configuration.addMapper(BoundBlogMapper.class);
  configuration.addMapper(BoundAuthorMapper.class);
  sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
}
 
Example 4
Source File: AbstractDataBaseBean.java    From spring-boot-starter-dao with Apache License 2.0 5 votes vote down vote up
protected Configuration cloneConfiguration(Configuration configuration) { 
	Configuration relust=new Configuration();
	relust.setEnvironment(configuration.getEnvironment());
	relust.setSafeRowBoundsEnabled(configuration.isSafeRowBoundsEnabled());
	relust.setSafeResultHandlerEnabled(configuration.isSafeResultHandlerEnabled());
	relust.setMapUnderscoreToCamelCase(configuration.isMapUnderscoreToCamelCase());
	relust.setAggressiveLazyLoading(configuration.isAggressiveLazyLoading());
	relust.setMultipleResultSetsEnabled(configuration.isMultipleResultSetsEnabled());
	relust.setUseGeneratedKeys(configuration.isUseGeneratedKeys());
	relust.setUseColumnLabel(configuration.isUseColumnLabel());
	relust.setCacheEnabled(configuration.isCacheEnabled());
	relust.setCallSettersOnNulls(configuration.isCallSettersOnNulls());
	relust.setUseActualParamName(configuration.isUseActualParamName());
	relust.setReturnInstanceForEmptyRow(configuration.isReturnInstanceForEmptyRow());
	relust.setLogPrefix(configuration.getLogPrefix());
	relust.setLogImpl(configuration.getLogImpl());
	relust.setVfsImpl(configuration.getVfsImpl());
	relust.setLocalCacheScope(configuration.getLocalCacheScope());
	relust.setJdbcTypeForNull(configuration.getJdbcTypeForNull());
	relust.setLazyLoadTriggerMethods(configuration.getLazyLoadTriggerMethods());
	relust.setDefaultStatementTimeout(configuration.getDefaultStatementTimeout());
	relust.setDefaultFetchSize(configuration.getDefaultFetchSize());
	relust.setDefaultExecutorType(configuration.getDefaultExecutorType());
	relust.setAutoMappingBehavior(configuration.getAutoMappingBehavior());
	relust.setAutoMappingUnknownColumnBehavior(configuration.getAutoMappingUnknownColumnBehavior());
	relust.setVariables(configuration.getVariables());
	relust.setReflectorFactory(configuration.getReflectorFactory());
	relust.setObjectFactory(configuration.getObjectFactory());
	relust.setObjectWrapperFactory(configuration.getObjectWrapperFactory());
	relust.setLazyLoadingEnabled(configuration.isLazyLoadingEnabled());
	relust.setProxyFactory(configuration.getProxyFactory());
	relust.setDatabaseId(configuration.getDatabaseId());
	relust.setConfigurationFactory(configuration.getConfigurationFactory());
	relust.getTypeHandlerRegistry().setDefaultEnumTypeHandler(GlobalEnumTypeHandler.class);
	return relust;
}
 
Example 5
Source File: BaseExecutorTest.java    From mybaties with Apache License 2.0 5 votes vote down vote up
public BaseExecutorTest() {
  config = new Configuration();
  config.setLazyLoadingEnabled(true);
  config.setUseGeneratedKeys(false);
  config.setMultipleResultSetsEnabled(true);
  config.setUseColumnLabel(true);
  config.setDefaultStatementTimeout(5000);
}