当前位置: 首页>>代码示例>>Java>>正文


Java SessionFactoryImpl.getConnectionProvider方法代码示例

本文整理汇总了Java中org.hibernate.internal.SessionFactoryImpl.getConnectionProvider方法的典型用法代码示例。如果您正苦于以下问题:Java SessionFactoryImpl.getConnectionProvider方法的具体用法?Java SessionFactoryImpl.getConnectionProvider怎么用?Java SessionFactoryImpl.getConnectionProvider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hibernate.internal.SessionFactoryImpl的用法示例。


在下文中一共展示了SessionFactoryImpl.getConnectionProvider方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: closeFactory

import org.hibernate.internal.SessionFactoryImpl; //导入方法依赖的package包/类
public void closeFactory() {                    // shutdown persistence engine
    if (factory != null) {
        if (factory instanceof SessionFactoryImpl) {
           SessionFactoryImpl sf = (SessionFactoryImpl) factory;
           ConnectionProvider conn = sf.getConnectionProvider();
           if (conn instanceof C3P0ConnectionProvider) {
             ((C3P0ConnectionProvider)conn).stop();
           }
        }

        factory.close();
    }
}
 
开发者ID:yawlfoundation,项目名称:yawl,代码行数:14,代码来源:YPersistenceManager.java

示例2: closeFactory

import org.hibernate.internal.SessionFactoryImpl; //导入方法依赖的package包/类
public void closeFactory() {
    if (_factory != null) {
        if (_factory instanceof SessionFactoryImpl) {
           SessionFactoryImpl sf = (SessionFactoryImpl) _factory;
           ConnectionProvider conn = sf.getConnectionProvider();
           if (conn instanceof C3P0ConnectionProvider) {
             ((C3P0ConnectionProvider)conn).stop();
           }
        }

        _factory.close();
    }
}
 
开发者ID:yawlfoundation,项目名称:yawl,代码行数:14,代码来源:HibernateEngine.java

示例3: getDefaultDataSource

import org.hibernate.internal.SessionFactoryImpl; //导入方法依赖的package包/类
/**
	 * Get Default DataSource. JNDI name of datasource is taken from Entity Manager
	 *
	 * @return
	 * @throws NamingException
	 */
	public static DataSource getDefaultDataSource(EntityManager em) throws NamingException {
// 		Doesn't work because of https://hibernate.atlassian.net/browse/HHH-8121
//		EntityManagerFactory emFactory = em.getEntityManagerFactory();
//		Object ds = emFactory.getProperties().get("javax.persistence.jtaDataSource");
//		InitialContext initialContext = new InitialContext();
//		Object lookup = initialContext.lookup(ds.toString());
//		return (DataSource) lookup;

// 		TODO: Find better way how to get DataSource from JPA without using hard coded JNDI name or casting to JPA implementation
		SessionFactoryImpl factory = (SessionFactoryImpl) em.unwrap(Session.class).getSessionFactory(); // or directly cast the sessionFactory
		DatasourceConnectionProviderImpl provider = (DatasourceConnectionProviderImpl) factory.getConnectionProvider();
		return provider.getDataSource();
	}
 
开发者ID:searchisko,项目名称:searchisko,代码行数:20,代码来源:CdiHelper.java

示例4: getConnectionProvider

import org.hibernate.internal.SessionFactoryImpl; //导入方法依赖的package包/类
public DriverManagerConnectionProviderImpl getConnectionProvider() {
	SessionFactoryImpl factory = (SessionFactoryImpl) em.unwrap(Session.class).getSessionFactory();
	return (DriverManagerConnectionProviderImpl) factory.getConnectionProvider();
}
 
开发者ID:searchisko,项目名称:searchisko,代码行数:5,代码来源:JpaTestBase.java


注:本文中的org.hibernate.internal.SessionFactoryImpl.getConnectionProvider方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。