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


Java ServiceRegistryBuilder.addService方法代碼示例

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


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

示例1: createSessionFactory

import org.hibernate.service.ServiceRegistryBuilder; //導入方法依賴的package包/類
/**
 * Configuration of session factory with Fabric integration.
 */
public static SessionFactory createSessionFactory(String fabricUrl, String username, String password, String fabricUser, String fabricPassword)
        throws Exception {
    // creating this here allows passing needed params to the constructor
    FabricMultiTenantConnectionProvider connProvider = new FabricMultiTenantConnectionProvider(fabricUrl, "employees", "employees", username, password,
            fabricUser, fabricPassword);
    ServiceRegistryBuilder srb = new ServiceRegistryBuilder();
    srb.addService(org.hibernate.service.jdbc.connections.spi.MultiTenantConnectionProvider.class, connProvider);
    srb.applySetting("hibernate.dialect", "org.hibernate.dialect.MySQLInnoDBDialect");

    Configuration config = new Configuration();
    config.setProperty("hibernate.multiTenancy", "DATABASE");
    config.addResource("com/mysql/fabric/demo/employee.hbm.xml");
    return config.buildSessionFactory(srb.buildServiceRegistry());
}
 
開發者ID:Jugendhackt,項目名稱:OpenVertretung,代碼行數:18,代碼來源:HibernateFabric.java

示例2: createSessionFactory

import org.hibernate.service.ServiceRegistryBuilder; //導入方法依賴的package包/類
/**
   * Configuration of session factory with Fabric integration.
   */
  public static SessionFactory createSessionFactory(String fabricUrl, String username, String password, String fabricUser, String fabricPassword) throws Exception {
// creating this here allows passing needed params to the constructor
FabricMultiTenantConnectionProvider connProvider = new FabricMultiTenantConnectionProvider(fabricUrl, "employees", "employees", username, password, fabricUser, fabricPassword);
ServiceRegistryBuilder srb = new ServiceRegistryBuilder();
srb.addService(org.hibernate.service.jdbc.connections.spi.MultiTenantConnectionProvider.class, connProvider);
      srb.applySetting("hibernate.dialect", "org.hibernate.dialect.MySQLInnoDBDialect");

Configuration config = new Configuration();
      config.setProperty("hibernate.multiTenancy", "DATABASE");
      config.addResource("com/mysql/fabric/demo/employee.hbm.xml");
return config.buildSessionFactory(srb.buildServiceRegistry());
  }
 
開發者ID:hinsenchan,項目名稱:fil_project_mgmt_app_v2,代碼行數:16,代碼來源:HibernateFabric.java

示例3: registryBuilder

import org.hibernate.service.ServiceRegistryBuilder; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Nullable @Override protected ServiceRegistryBuilder registryBuilder() {
    ServiceRegistryBuilder builder = new ServiceRegistryBuilder();

    DatasourceConnectionProviderImpl connProvider = new DatasourceConnectionProviderImpl();

    BasicManagedDataSource dataSrc = new BasicManagedDataSource(); // JTA-aware data source.

    dataSrc.setTransactionManager(jotm.getTransactionManager());

    dataSrc.setDefaultAutoCommit(false);

    JdbcDataSource h2DataSrc = new JdbcDataSource();

    h2DataSrc.setURL(CONNECTION_URL);

    dataSrc.setXaDataSourceInstance(h2DataSrc);

    connProvider.setDataSource(dataSrc);

    connProvider.configure(Collections.emptyMap());

    builder.addService(ConnectionProvider.class, connProvider);

    builder.addService(JtaPlatform.class, new TestJtaPlatform());

    builder.addService(TransactionFactory.class, new JtaTransactionFactory());

    return builder;
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:31,代碼來源:HibernateL2CacheTransactionalSelfTest.java


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