コード例 #1
0
 private Executor newExecutor() throws SQLException {
   final Environment environment = configuration.getEnvironment();
   if (environment == null)
     throw new ExecutorException(
         "ResultLoader could not load lazily.  Environment was not configured.");
   final DataSource ds = environment.getDataSource();
   if (ds == null)
     throw new ExecutorException(
         "ResultLoader could not load lazily.  DataSource was not configured.");
   final TransactionFactory transactionFactory = environment.getTransactionFactory();
   final Transaction tx = transactionFactory.newTransaction(ds, null, false);
   return configuration.newExecutor(tx, ExecutorType.SIMPLE);
 }
コード例 #2
0
 private TransactionFactory getTransactionFactoryFromEnvironment(Environment environment) {
   if (environment == null || environment.getTransactionFactory() == null) {
     return managedTransactionFactory;
   }
   return environment.getTransactionFactory();
 }