List of usage examples for org.apache.ibatis.session Configuration setSafeRowBoundsEnabled
public void setSafeRowBoundsEnabled(boolean safeRowBoundsEnabled)
From source file:com.dvdprime.server.mobile.config.MyBatisConfig.java
License:Apache License
/** * MyBatis ? Configuration? .//w w w .ja v a2 s . c o m * * @return */ public Configuration getConfig() { TransactionFactory transactionFactory = new JdbcTransactionFactory(); Environment environment = new Environment("master", transactionFactory, getTomcatDataSource()); logger.info("MyBatis Configuration Initialization."); Configuration configuration = new Configuration(environment); configuration.setCacheEnabled(true); configuration.setLazyLoadingEnabled(false); configuration.setAggressiveLazyLoading(false); configuration.setUseColumnLabel(true); configuration.setUseGeneratedKeys(false); configuration.setAutoMappingBehavior(AutoMappingBehavior.PARTIAL); configuration.setDefaultExecutorType(ExecutorType.REUSE); configuration.setDefaultStatementTimeout(25000); configuration.setSafeRowBoundsEnabled(true); // Alias Type Iterator<String> it = TypeAliasProp.getProperties().keySet().iterator(); while (it.hasNext()) { String key = it.next(); logger.info("typeAliasRegistry: [{}] -> [{}]", key, TypeAliasProp.getProperties().get(key)); configuration.getTypeAliasRegistry().registerAlias(key, (String) TypeAliasProp.getProperties().get(key)); } // Mapper it = MapperProp.getProperties().keySet().iterator(); while (it.hasNext()) { String key = it.next(); logger.info("mapper loaded: [{}]", MapperProp.getProperties().get(key)); try { InputStream inputStream = Resources .getResourceAsStream((String) MapperProp.getProperties().get(key)); XMLMapperBuilder mapperParser = new XMLMapperBuilder(inputStream, configuration, (String) MapperProp.getProperties().get(key), configuration.getSqlFragments()); mapperParser.parse(); } catch (IOException e) { logger.error("mapper parsing ?."); } } return configuration; }