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 org.hibernate.boot.Metadata |
metaData |
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)
Get Hibernate
Dialect to use for given 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.boot.Metadata |
getMetaData() |
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 |
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)
Deprecated.
Hibernate can do a much better job at guessing the dialect by calling JDBC and discovering the actual DBMS version and the dialect to use.
|
org.hibernate.cfg.Configuration |
newHibernateConfiguration()
Creates a new Configuration instance.
|
org.hibernate.boot.Metadata |
newMetaData(org.hibernate.cfg.Configuration configuration,
org.hibernate.SessionFactory sessionFactory) |
org.hibernate.boot.Metadata |
newMetaData(org.hibernate.cfg.Configuration configuration,
org.hibernate.SessionFactory sessionFactory,
Collection<Class<?>> entityClasses) |
org.hibernate.SessionFactory |
newSessionFactory(org.hibernate.cfg.Configuration effectiveHibernateConfiguration) |
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
protected org.hibernate.boot.Metadata metaData
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)
Dialect to use for given TopiaConfiguration.
Prefer user defined dialect over dialect guessed by ToPIA;
Warn user if dialect declared seems wrong (H2 dialect for a PostgreSQL database)TopiaMisconfigurationException - if user must add dialect to its configuration (because it can not be guessed)@Deprecated public static String guessHibernateDialect(String jdbcConnectionUrl)
public 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)
S - type of servicesessionFactory - 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()
public org.hibernate.SessionFactory newSessionFactory(org.hibernate.cfg.Configuration effectiveHibernateConfiguration)
public org.hibernate.boot.Metadata getMetaData()
public org.hibernate.boot.Metadata newMetaData(org.hibernate.cfg.Configuration configuration,
org.hibernate.SessionFactory sessionFactory)
public org.hibernate.boot.Metadata newMetaData(org.hibernate.cfg.Configuration configuration,
org.hibernate.SessionFactory sessionFactory,
Collection<Class<?>> entityClasses)
Copyright © 2004–2018 CodeLutin. All rights reserved.