當前位置: 首頁>>代碼示例>>Java>>正文


Java TransactionFactory.setProperties方法代碼示例

本文整理匯總了Java中org.apache.ibatis.transaction.TransactionFactory.setProperties方法的典型用法代碼示例。如果您正苦於以下問題:Java TransactionFactory.setProperties方法的具體用法?Java TransactionFactory.setProperties怎麽用?Java TransactionFactory.setProperties使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.ibatis.transaction.TransactionFactory的用法示例。


在下文中一共展示了TransactionFactory.setProperties方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: transactionManagerElement

import org.apache.ibatis.transaction.TransactionFactory; //導入方法依賴的package包/類
/**
 *  解析<transactionManager>節點,創建對應的TransactionFactory 
 *  <environment>節點定義了連接某個數據庫的信息,
 *  其子節點<transactionManager> 的type 會決定我們用什麽類型的事務管理機製。
 * @param context
 * @return
 * @throws Exception
 */
private TransactionFactory transactionManagerElement(XNode context) throws Exception {
  if (context != null) {
    //type=JDBC,使用jdbc管理事務;type=MANAGED,使用WEB容器(Tomcat、JBOSS)管理事務
    String type = context.getStringAttribute("type");
    Properties props = context.getChildrenAsProperties();
    /*在Configuration初始化的時候,會通過以下語句,給JDBC和MANAGED對應的工廠類 
    typeAliasRegistry.registerAlias("JDBC", JdbcTransactionFactory.class); 
    typeAliasRegistry.registerAlias("MANAGED", ManagedTransactionFactory.class); 
    下述的resolveClass(type).newInstance()會創建對應的工廠實例 */
    TransactionFactory factory = (TransactionFactory) resolveClass(type).newInstance();
    factory.setProperties(props);
    return factory;
  }
  throw new BuilderException("Environment declaration requires a TransactionFactory.");
}
 
開發者ID:toulezu,項目名稱:play,代碼行數:24,代碼來源:XMLConfigBuilder.java

示例2: transactionManagerElement

import org.apache.ibatis.transaction.TransactionFactory; //導入方法依賴的package包/類
private TransactionFactory transactionManagerElement(XNode context) throws Exception {
    if (context != null) {
        String type = context.getStringAttribute("type");
        Properties props = context.getChildrenAsProperties();
        TransactionFactory factory = (TransactionFactory) resolveClass(type).newInstance();
        factory.setProperties(props);
        return factory;
    }
    throw new BuilderException("Environment declaration requires a TransactionFactory.");
}
 
開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:11,代碼來源:MybatisXMLConfigBuilder.java

示例3: transactionManagerElement

import org.apache.ibatis.transaction.TransactionFactory; //導入方法依賴的package包/類
private TransactionFactory transactionManagerElement(XNode context) throws Exception {
  if (context != null) {
    String type = context.getStringAttribute("type");
    Properties props = context.getChildrenAsProperties();
    TransactionFactory factory = (TransactionFactory) resolveClass(type).newInstance();
    factory.setProperties(props);
    return factory;
  }
  throw new BuilderException("Environment declaration requires a TransactionFactory.");
}
 
開發者ID:Alfresco,項目名稱:alfresco-core,代碼行數:11,代碼來源:HierarchicalXMLConfigBuilder.java

示例4: shouldEnsureThatCallsToManagedTransactionAPIDoNotForwardToManagedConnections

import org.apache.ibatis.transaction.TransactionFactory; //導入方法依賴的package包/類
@Test
public void shouldEnsureThatCallsToManagedTransactionAPIDoNotForwardToManagedConnections() throws Exception {
  TransactionFactory tf = new ManagedTransactionFactory();
  tf.setProperties(new Properties());
  Transaction tx = tf.newTransaction(conn);
  assertEquals(conn, tx.getConnection());
  tx.commit();
  tx.rollback();
  tx.close();
  verify(conn).close();
}
 
開發者ID:yuexiahandao,項目名稱:MybatisCode,代碼行數:12,代碼來源:ManagedTransactionFactoryTest.java

示例5: shouldEnsureThatCallsToManagedTransactionAPIDoNotForwardToManagedConnectionsAndDoesNotCloseConnection

import org.apache.ibatis.transaction.TransactionFactory; //導入方法依賴的package包/類
@Test
public void shouldEnsureThatCallsToManagedTransactionAPIDoNotForwardToManagedConnectionsAndDoesNotCloseConnection() throws Exception {
  TransactionFactory tf = new ManagedTransactionFactory();
  Properties props = new Properties();
  props.setProperty("closeConnection", "false");
  tf.setProperties(props);
  Transaction tx = tf.newTransaction(conn);
  assertEquals(conn, tx.getConnection());
  tx.commit();
  tx.rollback();
  tx.close();
  verifyNoMoreInteractions(conn);
}
 
開發者ID:yuexiahandao,項目名稱:MybatisCode,代碼行數:14,代碼來源:ManagedTransactionFactoryTest.java

示例6: transactionManagerElement

import org.apache.ibatis.transaction.TransactionFactory; //導入方法依賴的package包/類
private TransactionFactory transactionManagerElement(XNode context) throws Exception {
	if (context != null) {
		String type = context.getStringAttribute("type");
		Properties props = context.getChildrenAsProperties();
		TransactionFactory factory = (TransactionFactory) resolveClass(type).newInstance();
		factory.setProperties(props);
		return factory;
	}
	throw new BuilderException("Environment declaration requires a TransactionFactory.");
}
 
開發者ID:whatlookingfor,項目名稱:spring-boot-sample,代碼行數:11,代碼來源:XMLConfigBuilder.java

示例7: transactionManagerElement

import org.apache.ibatis.transaction.TransactionFactory; //導入方法依賴的package包/類
private TransactionFactory transactionManagerElement(XNode context) throws Exception {
  if (context != null) {
    String type = context.getStringAttribute("type");
    Properties props = context.getChildrenAsProperties();
//根據type="JDBC"解析返回適當的TransactionFactory
    TransactionFactory factory = (TransactionFactory) resolveClass(type).newInstance();
    factory.setProperties(props);
    return factory;
  }
  throw new BuilderException("Environment declaration requires a TransactionFactory.");
}
 
開發者ID:shurun19851206,項目名稱:mybaties,代碼行數:12,代碼來源:XMLConfigBuilder.java


注:本文中的org.apache.ibatis.transaction.TransactionFactory.setProperties方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。