public class HibernateProvider extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Set<Class<? extends TopiaEntity>> |
entityClasses
List of persistent classes
|
protected org.hibernate.cfg.Configuration |
hibernateConfiguration |
protected org.hibernate.SessionFactory |
hibernateSessionFactory |
protected TopiaHibernateSessionRegistry |
sessionRegistry |
protected TopiaConfiguration |
topiaConfiguration |
protected TopiaServiceSupport |
topiaServiceSupport |
| Constructor and Description |
|---|
HibernateProvider(TopiaConfiguration topiaConfiguration,
TopiaServiceSupport topiaServiceSupport,
TopiaHibernateSessionRegistry sessionRegistry,
Set<Class<? extends TopiaEntity>> entityClasses) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
org.hibernate.cfg.Configuration |
getHibernateConfiguration()
Get the current Hibernate Configuration.
|
static String |
getHibernateDialect(TopiaConfiguration topiaConfiguration) |
static <S extends org.hibernate.service.Service> |
getHibernateService(org.hibernate.SessionFactory sessionFactory,
Class<S> serviceClass)
Method to get an Hibernate service instance from a given Hibernate SessionFactory
NB: This method is static to make sure it does not depend on the current instance
|
org.hibernate.SessionFactory |
getSessionFactory() |
protected static org.hibernate.service.spi.SessionFactoryServiceRegistry |
getSessionFactoryServiceRegistry(org.hibernate.SessionFactory sessionFactory)
Method to extract from the given Hibernate SessionFactory a working instance of SessionFactoryServiceRegistry
IMPORTANT : If possible, prefer using this method instead of
getStandardServiceRegistry(org.hibernate.SessionFactory) because the SessionFactoryServiceRegistry is a
child of the StandardServiceRegistry
NB: This method is static to make sure it does not depend on the current instance |
protected static org.hibernate.boot.registry.StandardServiceRegistry |
getStandardServiceRegistry(org.hibernate.SessionFactory sessionFactory)
Method to extract from the given Hibernate SessionFactory a working instance of StandardServiceRegistry
IMPORTANT : As much as possible, prefer using the
getSessionFactoryServiceRegistry(org.hibernate.SessionFactory) mthod instead of the current one because
the SessionFactoryServiceRegistry is a child of the StandardServiceRegistry
NB: This method is static to make sure it does not depend on the current instance |
static String |
guessHibernateDialect(String jdbcConnectionUrl) |
org.hibernate.cfg.Configuration |
newHibernateConfiguration()
Creates a new Configuration instance.
|
protected org.hibernate.SessionFactory hibernateSessionFactory
protected org.hibernate.cfg.Configuration hibernateConfiguration
protected TopiaConfiguration topiaConfiguration
protected TopiaServiceSupport topiaServiceSupport
protected TopiaHibernateSessionRegistry sessionRegistry
protected Set<Class<? extends TopiaEntity>> entityClasses
public HibernateProvider(TopiaConfiguration topiaConfiguration, TopiaServiceSupport topiaServiceSupport, TopiaHibernateSessionRegistry sessionRegistry, Set<Class<? extends TopiaEntity>> entityClasses)
public org.hibernate.cfg.Configuration getHibernateConfiguration()
newHibernateConfiguration() method. The returned instance is always initialized and mapping are built.public org.hibernate.cfg.Configuration newHibernateConfiguration()
public static String getHibernateDialect(TopiaConfiguration topiaConfiguration)
protected static org.hibernate.boot.registry.StandardServiceRegistry getStandardServiceRegistry(org.hibernate.SessionFactory sessionFactory)
getSessionFactoryServiceRegistry(org.hibernate.SessionFactory) mthod instead of the current one because
the SessionFactoryServiceRegistry is a child of the StandardServiceRegistry
NB: This method is static to make sure it does not depend on the current instancesessionFactory - the Hibernate's SessionFactory instanceprotected static org.hibernate.service.spi.SessionFactoryServiceRegistry getSessionFactoryServiceRegistry(org.hibernate.SessionFactory sessionFactory)
getStandardServiceRegistry(org.hibernate.SessionFactory) because the SessionFactoryServiceRegistry is a
child of the StandardServiceRegistry
NB: This method is static to make sure it does not depend on the current instancesessionFactory - the Hibernate's SessionFactory instancepublic static <S extends org.hibernate.service.Service> S getHibernateService(org.hibernate.SessionFactory sessionFactory,
Class<S> serviceClass)
sessionFactory - the Hibernate's SessionFactory instanceserviceClass - the expected service classorg.hibernate.service.UnknownServiceException - Indicates the service was not known.ServiceRegistry.getService(Class)public void close()
public org.hibernate.SessionFactory getSessionFactory()
Copyright © 2004–2015 CodeLutin. All rights reserved.