Search in sources :

Example 41 with SessionFactory

use of org.hibernate.SessionFactory in project wildfly by wildfly.

the class HibernateCollectionStatistics method getStatistics.

private CollectionStatistics getStatistics(final EntityManagerFactory entityManagerFactory, String collectionName) {
    if (entityManagerFactory == null) {
        return null;
    }
    HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
    SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
    if (sessionFactory != null) {
        return sessionFactory.getStatistics().getCollectionStatistics(collectionName);
    }
    return null;
}
Also used : SessionFactory(org.hibernate.SessionFactory) HibernateEntityManagerFactory(org.hibernate.jpa.HibernateEntityManagerFactory)

Example 42 with SessionFactory

use of org.hibernate.SessionFactory in project wildfly by wildfly.

the class HibernateEntityStatistics method getStatistics.

private org.hibernate.stat.EntityStatistics getStatistics(EntityManagerFactory entityManagerFactory, String entityName) {
    if (entityManagerFactory == null) {
        return null;
    }
    HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
    SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
    if (sessionFactory != null) {
        return sessionFactory.getStatistics().getEntityStatistics(entityName);
    }
    return null;
}
Also used : SessionFactory(org.hibernate.SessionFactory) HibernateEntityManagerFactory(org.hibernate.jpa.HibernateEntityManagerFactory)

Example 43 with SessionFactory

use of org.hibernate.SessionFactory in project wildfly by wildfly.

the class HibernateQueryCacheStatistics method getBaseStatistics.

private org.hibernate.stat.Statistics getBaseStatistics(EntityManagerFactory entityManagerFactory) {
    if (entityManagerFactory == null) {
        return null;
    }
    HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
    SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
    if (sessionFactory != null) {
        return sessionFactory.getStatistics();
    }
    return null;
}
Also used : SessionFactory(org.hibernate.SessionFactory) HibernateEntityManagerFactory(org.hibernate.jpa.HibernateEntityManagerFactory)

Example 44 with SessionFactory

use of org.hibernate.SessionFactory in project wildfly by wildfly.

the class HibernateStatistics method getStatistics.

static final org.hibernate.stat.Statistics getStatistics(final EntityManagerFactory entityManagerFactory) {
    if (entityManagerFactory == null) {
        return null;
    }
    HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
    SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
    if (sessionFactory != null) {
        return sessionFactory.getStatistics();
    }
    return null;
}
Also used : SessionFactory(org.hibernate.SessionFactory) HibernateEntityManagerFactory(org.hibernate.jpa.HibernateEntityManagerFactory)

Example 45 with SessionFactory

use of org.hibernate.SessionFactory in project intellij-community by JetBrains.

the class HibernateResourceInspection method foo2.

public void foo2() {
    final SessionFactory factory = null;
    final Session session = factory.openSession();
}
Also used : SessionFactory(org.hibernate.SessionFactory) Session(org.hibernate.classic.Session)

Aggregations

SessionFactory (org.hibernate.SessionFactory)108 Test (org.junit.Test)62 Session (org.hibernate.Session)50 Configuration (org.hibernate.cfg.Configuration)35 Transaction (org.hibernate.Transaction)20 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)19 StandardServiceRegistry (org.hibernate.boot.registry.StandardServiceRegistry)13 MetadataSources (org.hibernate.boot.MetadataSources)11 HibernateEntityManagerFactory (org.hibernate.jpa.HibernateEntityManagerFactory)9 TestForIssue (org.hibernate.testing.TestForIssue)9 Properties (java.util.Properties)8 Query (org.hibernate.Query)8 Metadata (org.hibernate.boot.Metadata)8 ArrayList (java.util.ArrayList)7 InfinispanRegionFactory (org.hibernate.cache.infinispan.InfinispanRegionFactory)7 List (java.util.List)6 CountDownLatch (java.util.concurrent.CountDownLatch)6 TimeUnit (java.util.concurrent.TimeUnit)5 AnnotationException (org.hibernate.AnnotationException)5 Collections (java.util.Collections)4