org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory类的使用及代码示例

x33g5p2x  于9个月前 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(13)

本文整理了Java中org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory类的一些代码示例,展示了JdbcTransactionFactory类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JdbcTransactionFactory类的具体详情如下:
包路径:org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory
类名称:JdbcTransactionFactory

JdbcTransactionFactory介绍

[英]Creates JdbcTransaction instances.
[中]创建JdbcTransaction实例。

代码示例

代码示例来源:origin: SonarSource/sonarqube

private static JdbcTransactionFactory createTransactionFactory() {
  return new JdbcTransactionFactory();
 }
}

代码示例来源:origin: Activiti/Activiti

public void initTransactionFactory() {
 if (transactionFactory == null) {
  if (transactionsExternallyManaged) {
   transactionFactory = new ManagedTransactionFactory();
  } else {
   transactionFactory = new JdbcTransactionFactory();
  }
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

protected void initTransactionFactory() {
 if (transactionFactory == null) {
  if (transactionsExternallyManaged) {
   transactionFactory = new ManagedTransactionFactory();
  } else {
   transactionFactory = new JdbcTransactionFactory();
  }
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

protected void initTransactionFactory() {
 if (transactionFactory == null) {
  if (transactionsExternallyManaged) {
   transactionFactory = new ManagedTransactionFactory();
  } else {
   transactionFactory = new JdbcTransactionFactory();
  }
 }
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-db

private static JdbcTransactionFactory createTransactionFactory() {
  return new JdbcTransactionFactory();
 }
}

代码示例来源:origin: org.camunda.bpm/camunda-engine

protected void initTransactionFactory() {
 if (transactionFactory == null) {
  if (transactionsExternallyManaged) {
   transactionFactory = new ManagedTransactionFactory();
  } else {
   transactionFactory = new JdbcTransactionFactory();
  }
 }
}

代码示例来源:origin: stackoverflow.com

TransactionFactory transactionFactory = new JdbcTransactionFactory();
Environment environment = new Environment(dbName, transactionFactory,  dataSource);
Configuration configuration = new Configuration(environment);

/**
*This is the cause why LAZY LOADING is working now
*/
 configuration.getLazyLoadTriggerMethods().clear();

 ///////////////////////////////////////////////////
 configuration.setLazyLoadingEnabled(true);
 configuration.setAggressiveLazyLoading(false);

代码示例来源:origin: org.flowable/flowable-engine

@Override
public void initTransactionFactory() {
  if (transactionFactory == null) {
    if (transactionsExternallyManaged) {
      transactionFactory = new ManagedTransactionFactory();
    } else {
      transactionFactory = new JdbcTransactionFactory();
    }
  }
}

代码示例来源:origin: org.flowable/flowable5-engine

protected void initTransactionFactory() {
  if (transactionFactory == null) {
    if (transactionsExternallyManaged) {
      transactionFactory = new ManagedTransactionFactory();
    } else {
      transactionFactory = new JdbcTransactionFactory();
    }
  }
}

代码示例来源:origin: stackoverflow.com

DataSource dataSource = BlogDataSourceFactory.getBlogDataSource();
TransactionFactory transactionFactory = new JdbcTransactionFactory();
Environment environment = new Environment("development", transactionFactory, dataSource); 
Configuration configuration = new Configuration(environment);

代码示例来源:origin: org.activiti/activiti-engine

public void initTransactionFactory() {
 if (transactionFactory == null) {
  if (transactionsExternallyManaged) {
   transactionFactory = new ManagedTransactionFactory();
  } else {
   transactionFactory = new JdbcTransactionFactory();
  }
 }
}

代码示例来源:origin: com.bbossgroups.activiti/activiti-engine

protected void initTransactionFactory() {
 if (transactionFactory==null) {
  if (transactionsExternallyManaged) {
   transactionFactory = new ManagedTransactionFactory();
  } else {
   transactionFactory = new JdbcTransactionFactory();
  }
 }
}

代码示例来源:origin: martin-grofcik/activiti-crystalball

protected void initTransactionFactory() {
 if (transactionFactory==null) {
  if (transactionsExternallyManaged) {
   transactionFactory = new ManagedTransactionFactory();
  } else {
   transactionFactory = new JdbcTransactionFactory();
  }
 }
}

代码示例来源:origin: mybatis-book/book

public static void main(String[] args) throws IOException {
  UnpooledDataSource dataSource = new UnpooledDataSource(
      "com.mysql.jdbc.Driver", 
      "jdbc:mysql://localhost:3306/mybatis", 
      "root", 
      "");
  TransactionFactory transactionFactory = new JdbcTransactionFactory();
  Environment environment = new Environment("Java", transactionFactory, dataSource);
  
  Configuration configuration = new Configuration(environment);
  configuration.getTypeAliasRegistry().registerAliases("tk.mybatis.simple.model");
  configuration.setLogImpl(Log4jImpl.class);
  
  InputStream inputStream = Resources.getResourceAsStream("tk/mybatis/simple/mapper/CountryMapper.xml");
  XMLMapperBuilder mapperParser = new XMLMapperBuilder(inputStream, configuration, "tk/mybatis/simple/mapper/CountryMapper.xml", configuration.getSqlFragments());
  mapperParser.parse();
  
  SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
  SqlSession sqlSession = sqlSessionFactory.openSession();
  try {
    List<Country> countryList = sqlSession.selectList("selectAll");
    printCountryList(countryList);
  } finally {
    sqlSession.close();
  }
}

代码示例来源:origin: dk.netdesign/mybatis-extender-runtime

private Environment buildEnvironment(MybatisConfiguration service) {
  return new Environment(service.getClass().getCanonicalName(), new JdbcTransactionFactory(), buildDataSource(service));
}

代码示例来源:origin: org.flowable/flowable-engine-common

public void initTransactionFactory() {
  if (transactionFactory == null) {
    if (transactionsExternallyManaged) {
      transactionFactory = new ManagedTransactionFactory();
      Properties properties = new Properties();
      properties.put("closeConnection", "false");
      this.transactionFactory.setProperties(properties);
    } else {
      transactionFactory = new JdbcTransactionFactory();
    }
  }
}

代码示例来源:origin: org.ow2.petals.flowable/flowable-engine-common

public void initTransactionFactory() {
  if (transactionFactory == null) {
    if (transactionsExternallyManaged) {
      transactionFactory = new ManagedTransactionFactory();
      Properties properties = new Properties();
      properties.put("closeConnection", "false");
      this.transactionFactory.setProperties(properties);
    } else {
      transactionFactory = new JdbcTransactionFactory();
    }
  }
}

代码示例来源:origin: stackoverflow.com

DataSource dataSource = BlogDataSourceFactory.getBlogDataSource();
TransactionFactory transactionFactory = new JdbcTransactionFactory();
Environment environment = new Environment("development", transactionFactory, dataSource);
Configuration configuration = new Configuration(environment);
configuration.addMapper(BlogMapper.class);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);

代码示例来源:origin: gncloud/fastcatsearch

@Override
protected boolean doLoad() throws ModuleException {
  Properties driverProperties = new Properties();
  driverProperties.setProperty("driver.encoding", "UTF-8");
  //******* driverProperties *****
  //poolMaximumActiveConnections
  //poolMaximumIdleConnections
  //poolMaximumCheckoutTime
  //poolTimeToWait
  //poolPingQuery
  //poolPingEnabled
  //poolPingConnectionsNotUsedFor
  //////////////////////////////////
  
  PooledDataSource dataSource = new PooledDataSource(derbyEmbeddedDriver, dbPath, driverProperties);
  org.apache.ibatis.mapping.Environment environment = new org.apache.ibatis.mapping.Environment("ID", new JdbcTransactionFactory(), dataSource);
  Configuration configuration = new Configuration(environment);
  
  if(mapperFileList != null){
    for(URL mapperFile : mapperFileList){
      addSqlMappings(configuration, mapperFile);
    }
  }
  
  sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
  logger.info("DBModule[{}] Loaded! with {}", dbPath, mapperFileList);
  return true;
}

代码示例来源:origin: stackoverflow.com

import javax.sql.DataSource;

import org.apache.ibatis.mapping.Environment;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.ibatis.transaction.TransactionFactory;
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;

String user = "xxxxx";
String password = "xxxxx";
String databasenameURL = "jdbc:oracle:thin:@xxxx:xxxx:xxxx";
String dbDriver = "oracle.jdbc.driver.OracleDriver";

DataSource dataSource = new org.apache.ibatis.datasource.pooled.PooledDataSource(
    dbDriver, databasenameURL, user, password);
TransactionFactory transactionFactory = new JdbcTransactionFactory();
Environment environment = new Environment("development",
    transactionFactory, dataSource);
Configuration configuration = new Configuration(environment);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder()
    .build(configuration);

相关文章

JdbcTransactionFactory类方法