本文整理汇总了Java中org.hibernate.jpa.HibernateEntityManagerFactory.getSessionFactory方法的典型用法代码示例。如果您正苦于以下问题:Java HibernateEntityManagerFactory.getSessionFactory方法的具体用法?Java HibernateEntityManagerFactory.getSessionFactory怎么用?Java HibernateEntityManagerFactory.getSessionFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.jpa.HibernateEntityManagerFactory
的用法示例。
在下文中一共展示了HibernateEntityManagerFactory.getSessionFactory方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStatistics
import org.hibernate.jpa.HibernateEntityManagerFactory; //导入方法依赖的package包/类
private org.hibernate.stat.QueryStatistics getStatistics(EntityManagerFactory entityManagerFactory, String displayQueryName) {
HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
// convert displayed (transformed by QueryNames) query name to original query name to look up query statistics
if (sessionFactory != null) {
String[] originalQueryNames = sessionFactory.getStatistics().getQueries();
if (originalQueryNames != null) {
for (String originalQueryName : originalQueryNames) {
if (QueryName.queryName(originalQueryName).getDisplayName().equals(displayQueryName)) {
return sessionFactory.getStatistics().getQueryStatistics(originalQueryName);
}
}
}
}
return null;
}
示例2: invoke
import org.hibernate.jpa.HibernateEntityManagerFactory; //导入方法依赖的package包/类
@Override
public Object invoke(Object... args) {
String displayQueryName = getQueryName(args);
EntityManagerFactory entityManagerFactory = getEntityManagerFactory(args);
if (displayQueryName != null && entityManagerFactory != null) {
HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
// convert displayed (transformed by QueryNames) query name to original query name
if (sessionFactory != null) {
String[] originalQueryNames = sessionFactory.getStatistics().getQueries();
if (originalQueryNames != null) {
for (String originalQueryName : originalQueryNames) {
if (QueryName.queryName(originalQueryName).getDisplayName().equals(displayQueryName)) {
return originalQueryName;
}
}
}
}
}
return null;
}
示例3: HibernateLazyIdExtractor
import org.hibernate.jpa.HibernateEntityManagerFactory; //导入方法依赖的package包/类
public HibernateLazyIdExtractor(EntityManagerFactory emf)
{
this.persistenceUnitUtil = emf.getPersistenceUnitUtil();
final HibernateEntityManagerFactory emFactory = (HibernateEntityManagerFactory) emf;
this.factory = emFactory.getSessionFactory();
}
示例4: getUpdateSource
import org.hibernate.jpa.HibernateEntityManagerFactory; //导入方法依赖的package包/类
@Override
public SynchronizedUpdateSource getUpdateSource(
ExtendedSearchIntegrator searchIntegrator,
Map<Class<?>, RehashedTypeMetadata> rehashedTypeMetadataPerIndexRoot,
Map<Class<?>, List<Class<?>>> containedInIndexOf,
Properties properties,
EntityManagerFactory emf,
TransactionManager transactionManager,
Set<Class<?>> indexRelevantEntities) {
HibernateEntityManagerFactory hibernateEntityManagerFactory =
(HibernateEntityManagerFactory) emf;
SessionFactoryImpl sessionFactory = (SessionFactoryImpl) hibernateEntityManagerFactory.getSessionFactory();
ServiceRegistry serviceRegistry = sessionFactory.getServiceRegistry();
EventListenerRegistry listenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );
HibernateUpdateSource updateSource = new HibernateUpdateSource();
updateSource.initialize( searchIntegrator );
listenerRegistry.addDuplicationStrategy( new DuplicationStrategyImpl( HibernateUpdateSource.class ) );
listenerRegistry.appendListeners( EventType.POST_INSERT, updateSource );
listenerRegistry.appendListeners( EventType.POST_UPDATE, updateSource );
listenerRegistry.appendListeners( EventType.POST_DELETE, updateSource );
listenerRegistry.appendListeners( EventType.POST_COLLECTION_RECREATE, updateSource );
listenerRegistry.appendListeners( EventType.POST_COLLECTION_REMOVE, updateSource );
listenerRegistry.appendListeners( EventType.POST_COLLECTION_UPDATE, updateSource );
return updateSource;
}
开发者ID:Hotware,项目名称:Hibernate-Search-GenericJPA,代码行数:30,代码来源:HibernateSynchronizedUpdateSourceProvider.java
示例5: getBaseStatistics
import org.hibernate.jpa.HibernateEntityManagerFactory; //导入方法依赖的package包/类
private org.hibernate.stat.Statistics getBaseStatistics(EntityManagerFactory entityManagerFactory) {
HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
if (sessionFactory != null) {
return sessionFactory.getStatistics();
}
return null;
}
示例6: getStatistics
import org.hibernate.jpa.HibernateEntityManagerFactory; //导入方法依赖的package包/类
private CollectionStatistics getStatistics(final EntityManagerFactory entityManagerFactory, String collectionName) {
HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
if (sessionFactory != null) {
return sessionFactory.getStatistics().getCollectionStatistics(collectionName);
}
return null;
}
示例7: getStatistics
import org.hibernate.jpa.HibernateEntityManagerFactory; //导入方法依赖的package包/类
private org.hibernate.stat.EntityStatistics getStatistics(EntityManagerFactory entityManagerFactory, String entityName) {
HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
if (sessionFactory != null) {
return sessionFactory.getStatistics().getEntityStatistics(entityName);
}
return null;
}
示例8: getStatistics
import org.hibernate.jpa.HibernateEntityManagerFactory; //导入方法依赖的package包/类
static final org.hibernate.stat.Statistics getStatistics(final EntityManagerFactory entityManagerFactory) {
HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
if (sessionFactory != null) {
return sessionFactory.getStatistics();
}
return null;
}
示例9: getStatistics
import org.hibernate.jpa.HibernateEntityManagerFactory; //导入方法依赖的package包/类
org.hibernate.stat.SecondLevelCacheStatistics getStatistics(EntityManagerFactoryAccess entityManagerFactoryaccess, PathAddress pathAddress) {
String scopedPersistenceUnitName = pathAddress.getValue(HibernateStatistics.PROVIDER_LABEL);
HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactoryaccess.entityManagerFactory(scopedPersistenceUnitName);
SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
if (sessionFactory != null) {
// The entity class name is prefixed by the application scoped persistence unit name
return sessionFactory.getStatistics().getSecondLevelCacheStatistics(scopedPersistenceUnitName + "." +
pathAddress.getValue(HibernateStatistics.ENTITYCACHE));
}
return null;
}
示例10: sessionFactory
import org.hibernate.jpa.HibernateEntityManagerFactory; //导入方法依赖的package包/类
@Bean
public SessionFactory sessionFactory(HibernateEntityManagerFactory hemf){
return hemf.getSessionFactory();
}