org.hibernate.ejb
Class Ejb3Configuration

java.lang.Object
  extended by org.hibernate.ejb.Ejb3Configuration
All Implemented Interfaces:
Serializable

public class Ejb3Configuration
extends Object
implements Serializable

Author:
Emmanuel Bernard
See Also:
Serialized Form

Constructor Summary
Ejb3Configuration()
           
 
Method Summary
 Ejb3Configuration addAnnotatedClass(Class persistentClass)
           
 void addAuxiliaryDatabaseObject(org.hibernate.mapping.AuxiliaryDatabaseObject object)
           
 Ejb3Configuration addClass(Class persistentClass)
           
 Ejb3Configuration addFile(File xmlFile)
           
 Ejb3Configuration addFile(String xmlFile)
           
 void addFilterDefinition(org.hibernate.engine.FilterDefinition definition)
           
 Ejb3Configuration addPackage(String packageName)
           
 Ejb3Configuration addProperties(Properties props)
           
 void buildMappings()
           
 org.hibernate.cfg.Settings buildSettings()
           
 Ejb3Configuration configure(String resource)
           
 javax.persistence.EntityManagerFactory createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo info)
          Create a factory from a PersistenceInfo object
 javax.persistence.EntityManagerFactory createEntityManagerFactory()
          Create an EntityManagerFactory when the configuration is ready
 javax.persistence.EntityManagerFactory createEntityManagerFactory(Map workingVars)
          create a factory from a list of properties and HibernatePersistence.CLASS_NAMES -> Collection (use to list the classes from config files HibernatePersistence.PACKAGE_NAMES -> Collection (use to list the mappings from config files HibernatePersistence.HBXML_FILES -> Collection (input streams of hbm files) HibernatePersistence.LOADED_CLASSES -> Collection (list of loaded classes)

Used by JBoss AS only

 javax.persistence.EntityManagerFactory createEntityManagerFactory(String emName, Map map)
          Get an entity manager factory by its entity manager name and given the appropriate extra properties.
 org.hibernate.mapping.PersistentClass getClassMapping(String persistentClass)
           
 Iterator getClassMappings()
           
 org.hibernate.mapping.Collection getCollectionMapping(String role)
           
 org.hibernate.event.EventListeners getEventListeners()
           
 Map getFilterDefinitions()
           
 org.hibernate.Interceptor getInterceptor()
           
 Map getNamedQueries()
           
 org.hibernate.cfg.NamingStrategy getNamingStrategy()
           
 Properties getProperties()
           
 Iterator getTableMappings()
           
 void setDataSource(DataSource ds)
          Used to inject a datasource object as the connection provider.
 void setEntityResolver(EntityResolver entityResolver)
           
 Ejb3Configuration setInterceptor(org.hibernate.Interceptor interceptor)
           
 void setListeners(String type, Object[] listeners)
           
 void setListeners(String type, String[] listenerClasses)
           
 Ejb3Configuration setNamingStrategy(org.hibernate.cfg.NamingStrategy namingStrategy)
           
 Ejb3Configuration setProperties(Properties properties)
           
 Ejb3Configuration setProperty(String key, String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ejb3Configuration

public Ejb3Configuration()
Method Detail

setDataSource

public void setDataSource(DataSource ds)
Used to inject a datasource object as the connection provider. If used, be sure to not override the Environment.CONNECTION_PROVIDER property


createEntityManagerFactory

public javax.persistence.EntityManagerFactory createEntityManagerFactory(String emName,
                                                                         Map map)
Get an entity manager factory by its entity manager name and given the appropriate extra properties. Those properties override the one get through the peristence.xml file.

Parameters:
emName - entity manager name
map - properties passed to the persistence provider
Returns:
initialized EntityManagerFactory

createContainerEntityManagerFactory

public javax.persistence.EntityManagerFactory createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo info)
Create a factory from a PersistenceInfo object


setProperty

public Ejb3Configuration setProperty(String key,
                                     String value)

createEntityManagerFactory

public javax.persistence.EntityManagerFactory createEntityManagerFactory(Map workingVars)
create a factory from a list of properties and HibernatePersistence.CLASS_NAMES -> Collection (use to list the classes from config files HibernatePersistence.PACKAGE_NAMES -> Collection (use to list the mappings from config files HibernatePersistence.HBXML_FILES -> Collection (input streams of hbm files) HibernatePersistence.LOADED_CLASSES -> Collection (list of loaded classes)

Used by JBoss AS only


createEntityManagerFactory

public javax.persistence.EntityManagerFactory createEntityManagerFactory()
Create an EntityManagerFactory when the configuration is ready


buildSettings

public org.hibernate.cfg.Settings buildSettings()
                                         throws org.hibernate.HibernateException
Throws:
org.hibernate.HibernateException

addProperties

public Ejb3Configuration addProperties(Properties props)

addAnnotatedClass

public Ejb3Configuration addAnnotatedClass(Class persistentClass)
                                    throws org.hibernate.MappingException
Throws:
org.hibernate.MappingException

configure

public Ejb3Configuration configure(String resource)
                            throws org.hibernate.HibernateException
Throws:
org.hibernate.HibernateException

addPackage

public Ejb3Configuration addPackage(String packageName)
                             throws org.hibernate.MappingException
Throws:
org.hibernate.MappingException

addFile

public Ejb3Configuration addFile(String xmlFile)
                          throws org.hibernate.MappingException
Throws:
org.hibernate.MappingException

addClass

public Ejb3Configuration addClass(Class persistentClass)
                           throws org.hibernate.MappingException
Throws:
org.hibernate.MappingException

addFile

public Ejb3Configuration addFile(File xmlFile)
                          throws org.hibernate.MappingException
Throws:
org.hibernate.MappingException

buildMappings

public void buildMappings()

getClassMappings

public Iterator getClassMappings()

getEventListeners

public org.hibernate.event.EventListeners getEventListeners()

getTableMappings

public Iterator getTableMappings()

getClassMapping

public org.hibernate.mapping.PersistentClass getClassMapping(String persistentClass)

getCollectionMapping

public org.hibernate.mapping.Collection getCollectionMapping(String role)

setEntityResolver

public void setEntityResolver(EntityResolver entityResolver)

getNamedQueries

public Map getNamedQueries()

getInterceptor

public org.hibernate.Interceptor getInterceptor()

getProperties

public Properties getProperties()

setInterceptor

public Ejb3Configuration setInterceptor(org.hibernate.Interceptor interceptor)

setProperties

public Ejb3Configuration setProperties(Properties properties)

getFilterDefinitions

public Map getFilterDefinitions()

addFilterDefinition

public void addFilterDefinition(org.hibernate.engine.FilterDefinition definition)

addAuxiliaryDatabaseObject

public void addAuxiliaryDatabaseObject(org.hibernate.mapping.AuxiliaryDatabaseObject object)

getNamingStrategy

public org.hibernate.cfg.NamingStrategy getNamingStrategy()

setNamingStrategy

public Ejb3Configuration setNamingStrategy(org.hibernate.cfg.NamingStrategy namingStrategy)

setListeners

public void setListeners(String type,
                         String[] listenerClasses)

setListeners

public void setListeners(String type,
                         Object[] listeners)