public class HibernateProvider extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,String> |
configuration |
protected org.hibernate.cfg.Configuration |
hibernateConfiguration |
protected org.hibernate.SessionFactory |
hibernateSessionFactory |
protected List<Class<?>> |
persistentClasses
List of persistent classes
|
protected TopiaHibernateSessionRegistry |
sessionRegistry |
protected TopiaServiceSupport |
topiaServiceSupport |
| Constructor and Description |
|---|
HibernateProvider(Map<String,String> configuration,
TopiaServiceSupport topiaServiceSupport,
TopiaHibernateSessionRegistry sessionRegistry) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
org.hibernate.cfg.Configuration |
getHibernateConfiguration() |
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
|
List<Class<?>> |
getPersistentClasses() |
protected String |
getProperty(String key) |
protected String |
getProperty(String key,
String defaultValue) |
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 |
protected org.hibernate.SessionFactory hibernateSessionFactory
protected org.hibernate.cfg.Configuration hibernateConfiguration
protected TopiaServiceSupport topiaServiceSupport
protected TopiaHibernateSessionRegistry sessionRegistry
public HibernateProvider(Map<String,String> configuration, TopiaServiceSupport topiaServiceSupport, TopiaHibernateSessionRegistry sessionRegistry)
public org.hibernate.cfg.Configuration getHibernateConfiguration()
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–2014 CodeLutin. All rights reserved.