Package org.openbravo.dal.core
Class DalSessionFactory
- java.lang.Object
-
- org.openbravo.dal.core.DalSessionFactory
-
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
,Referenceable
,javax.persistence.EntityManagerFactory
,org.hibernate.jpa.HibernateEntityManagerFactory
,org.hibernate.SessionFactory
public class DalSessionFactory extends Object implements org.hibernate.SessionFactory
The DalSessionFactory directly delegates all calls to a real SessionFactory except for the calls to open a session in that case an extra action is done to set session information in the database (and then the call is forwarded to the 'real' SessionFactory).- Author:
- mtaal
- See Also:
SessionFactoryController
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DalSessionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> void
addNamedEntityGraph(String graphName, javax.persistence.EntityGraph<T> entityGraph)
void
addNamedQuery(String name, javax.persistence.Query query)
void
close()
boolean
containsFetchProfileDefinition(String name)
javax.persistence.EntityManager
createEntityManager()
javax.persistence.EntityManager
createEntityManager(Map map)
javax.persistence.EntityManager
createEntityManager(javax.persistence.SynchronizationType synchronizationType)
javax.persistence.EntityManager
createEntityManager(javax.persistence.SynchronizationType synchronizationType, Map map)
<T> List<javax.persistence.EntityGraph<? super T>>
findEntityGraphsByType(Class<T> entityClass)
Map
getAllClassMetadata()
Map
getAllCollectionMetadata()
org.hibernate.Cache
getCache()
org.hibernate.metadata.ClassMetadata
getClassMetadata(Class persistentClass)
org.hibernate.metadata.ClassMetadata
getClassMetadata(String entityName)
org.hibernate.metadata.CollectionMetadata
getCollectionMetadata(String roleName)
javax.persistence.criteria.CriteriaBuilder
getCriteriaBuilder()
org.hibernate.Session
getCurrentSession()
Set
getDefinedFilterNames()
org.hibernate.SessionFactory
getDelegateSessionFactory()
NOTE: Openbravo requires normal application code to use the DalSessionFactory and not the real underlying Hibernate SessionFactory.org.hibernate.engine.spi.FilterDefinition
getFilterDefinition(String filterName)
org.hibernate.Metamodel
getMetamodel()
javax.persistence.PersistenceUnitUtil
getPersistenceUnitUtil()
Map<String,Object>
getProperties()
Reference
getReference()
org.hibernate.boot.spi.SessionFactoryOptions
getSessionFactoryOptions()
org.hibernate.stat.Statistics
getStatistics()
org.hibernate.TypeHelper
getTypeHelper()
boolean
isClosed()
boolean
isOpen()
org.hibernate.Session
openSession()
Note method sets user session information in the database and opens a connection for this.org.hibernate.StatelessSession
openStatelessSession()
Note method sets user session information in the database and opens a connection for this.org.hibernate.StatelessSession
openStatelessSession(Connection connection)
Note method sets user session information in the database and opens a connection for this.void
setDelegateSessionFactory(org.hibernate.SessionFactory delegateSessionFactory)
<T> T
unwrap(Class<T> clazz)
org.hibernate.SessionBuilder
withOptions()
org.hibernate.StatelessSessionBuilder
withStatelessOptions()
-
-
-
Method Detail
-
getDelegateSessionFactory
public org.hibernate.SessionFactory getDelegateSessionFactory()
NOTE: Openbravo requires normal application code to use the DalSessionFactory and not the real underlying Hibernate SessionFactory.- Returns:
- the underlying real sessionfactory
-
setDelegateSessionFactory
public void setDelegateSessionFactory(org.hibernate.SessionFactory delegateSessionFactory)
-
close
public void close() throws org.hibernate.HibernateException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfacejavax.persistence.EntityManagerFactory
- Specified by:
close
in interfaceorg.hibernate.SessionFactory
- Throws:
org.hibernate.HibernateException
-
getAllClassMetadata
public Map getAllClassMetadata() throws org.hibernate.HibernateException
- Specified by:
getAllClassMetadata
in interfaceorg.hibernate.SessionFactory
- Throws:
org.hibernate.HibernateException
-
getAllCollectionMetadata
public Map getAllCollectionMetadata() throws org.hibernate.HibernateException
- Specified by:
getAllCollectionMetadata
in interfaceorg.hibernate.SessionFactory
- Throws:
org.hibernate.HibernateException
-
getClassMetadata
public org.hibernate.metadata.ClassMetadata getClassMetadata(Class persistentClass) throws org.hibernate.HibernateException
- Specified by:
getClassMetadata
in interfaceorg.hibernate.SessionFactory
- Throws:
org.hibernate.HibernateException
-
getClassMetadata
public org.hibernate.metadata.ClassMetadata getClassMetadata(String entityName) throws org.hibernate.HibernateException
- Specified by:
getClassMetadata
in interfaceorg.hibernate.SessionFactory
- Throws:
org.hibernate.HibernateException
-
getCollectionMetadata
public org.hibernate.metadata.CollectionMetadata getCollectionMetadata(String roleName) throws org.hibernate.HibernateException
- Specified by:
getCollectionMetadata
in interfaceorg.hibernate.SessionFactory
- Throws:
org.hibernate.HibernateException
-
getCurrentSession
public org.hibernate.Session getCurrentSession() throws org.hibernate.HibernateException
- Specified by:
getCurrentSession
in interfaceorg.hibernate.SessionFactory
- Throws:
org.hibernate.HibernateException
-
getDefinedFilterNames
public Set getDefinedFilterNames()
- Specified by:
getDefinedFilterNames
in interfaceorg.hibernate.SessionFactory
-
getFilterDefinition
public org.hibernate.engine.spi.FilterDefinition getFilterDefinition(String filterName) throws org.hibernate.HibernateException
- Specified by:
getFilterDefinition
in interfaceorg.hibernate.SessionFactory
- Throws:
org.hibernate.HibernateException
-
getReference
public Reference getReference() throws NamingException
- Specified by:
getReference
in interfaceReferenceable
- Throws:
NamingException
-
getStatistics
public org.hibernate.stat.Statistics getStatistics()
- Specified by:
getStatistics
in interfaceorg.hibernate.SessionFactory
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceorg.hibernate.SessionFactory
-
openSession
public org.hibernate.Session openSession() throws org.hibernate.HibernateException
Note method sets user session information in the database and opens a connection for this.- Specified by:
openSession
in interfaceorg.hibernate.SessionFactory
- Throws:
org.hibernate.HibernateException
-
openStatelessSession
public org.hibernate.StatelessSession openStatelessSession()
Note method sets user session information in the database and opens a connection for this.- Specified by:
openStatelessSession
in interfaceorg.hibernate.SessionFactory
-
openStatelessSession
public org.hibernate.StatelessSession openStatelessSession(Connection connection)
Note method sets user session information in the database and opens a connection for this.- Specified by:
openStatelessSession
in interfaceorg.hibernate.SessionFactory
-
getCache
public org.hibernate.Cache getCache()
- Specified by:
getCache
in interfacejavax.persistence.EntityManagerFactory
- Specified by:
getCache
in interfaceorg.hibernate.SessionFactory
-
containsFetchProfileDefinition
public boolean containsFetchProfileDefinition(String name)
- Specified by:
containsFetchProfileDefinition
in interfaceorg.hibernate.SessionFactory
-
getTypeHelper
public org.hibernate.TypeHelper getTypeHelper()
- Specified by:
getTypeHelper
in interfaceorg.hibernate.SessionFactory
-
addNamedEntityGraph
public <T> void addNamedEntityGraph(String graphName, javax.persistence.EntityGraph<T> entityGraph)
- Specified by:
addNamedEntityGraph
in interfacejavax.persistence.EntityManagerFactory
-
addNamedQuery
public void addNamedQuery(String name, javax.persistence.Query query)
- Specified by:
addNamedQuery
in interfacejavax.persistence.EntityManagerFactory
-
createEntityManager
public javax.persistence.EntityManager createEntityManager()
- Specified by:
createEntityManager
in interfacejavax.persistence.EntityManagerFactory
-
createEntityManager
public javax.persistence.EntityManager createEntityManager(Map map)
- Specified by:
createEntityManager
in interfacejavax.persistence.EntityManagerFactory
-
createEntityManager
public javax.persistence.EntityManager createEntityManager(javax.persistence.SynchronizationType synchronizationType)
- Specified by:
createEntityManager
in interfacejavax.persistence.EntityManagerFactory
-
createEntityManager
public javax.persistence.EntityManager createEntityManager(javax.persistence.SynchronizationType synchronizationType, Map map)
- Specified by:
createEntityManager
in interfacejavax.persistence.EntityManagerFactory
-
getCriteriaBuilder
public javax.persistence.criteria.CriteriaBuilder getCriteriaBuilder()
- Specified by:
getCriteriaBuilder
in interfacejavax.persistence.EntityManagerFactory
-
getPersistenceUnitUtil
public javax.persistence.PersistenceUnitUtil getPersistenceUnitUtil()
- Specified by:
getPersistenceUnitUtil
in interfacejavax.persistence.EntityManagerFactory
-
getProperties
public Map<String,Object> getProperties()
- Specified by:
getProperties
in interfacejavax.persistence.EntityManagerFactory
-
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interfacejavax.persistence.EntityManagerFactory
-
unwrap
public <T> T unwrap(Class<T> clazz)
- Specified by:
unwrap
in interfacejavax.persistence.EntityManagerFactory
-
findEntityGraphsByType
public <T> List<javax.persistence.EntityGraph<? super T>> findEntityGraphsByType(Class<T> entityClass)
- Specified by:
findEntityGraphsByType
in interfaceorg.hibernate.jpa.HibernateEntityManagerFactory
-
getMetamodel
public org.hibernate.Metamodel getMetamodel()
- Specified by:
getMetamodel
in interfacejavax.persistence.EntityManagerFactory
- Specified by:
getMetamodel
in interfaceorg.hibernate.jpa.HibernateEntityManagerFactory
-
getSessionFactoryOptions
public org.hibernate.boot.spi.SessionFactoryOptions getSessionFactoryOptions()
- Specified by:
getSessionFactoryOptions
in interfaceorg.hibernate.SessionFactory
-
withOptions
public org.hibernate.SessionBuilder withOptions()
- Specified by:
withOptions
in interfaceorg.hibernate.SessionFactory
-
withStatelessOptions
public org.hibernate.StatelessSessionBuilder withStatelessOptions()
- Specified by:
withStatelessOptions
in interfaceorg.hibernate.SessionFactory
-
-