auxiliaryDatabaseObjects
protected List auxiliaryDatabaseObjects
classes
protected Map classes
collections
protected Map collections
columnNameBindingPerTable
protected Map columnNameBindingPerTable
extendsQueue
protected Map extendsQueue
filterDefinitions
protected Map filterDefinitions
imports
protected Map imports
namedQueries
protected Map namedQueries
namedSqlQueries
protected Map namedSqlQueries
propertyReferences
protected List propertyReferences
secondPasses
protected List secondPasses
sqlFunctions
protected Map sqlFunctions
sqlResultSetMappings
protected Map sqlResultSetMappings
Map result set name, result set description
tableNameBinding
protected Map tableNameBinding
tables
protected Map tables
typeDefs
protected Map typeDefs
addCacheableFile
public Configuration addCacheableFile(File xmlFile)
throws MappingException
Add a cached mapping file. A cached file is a serialized representation
of the DOM structure of a particular mapping. It is saved from a previous
call as a file with the name xmlFile + ".bin" where xmlFile is
the name of the original mapping file.
If a cached xmlFile + ".bin" exists and is newer than
xmlFile the ".bin" file will be read directly. Otherwise
xmlFile is read and then serialized to xmlFile + ".bin" for use
the next time.
xmlFile
- The cacheable mapping file to be added.
- this (for method chaining purposes)
MappingException
- Indicates problems reading the cached file or processing
the non-cached file.
addCacheableFile
public Configuration addCacheableFile(String xmlFile)
throws MappingException
Add a cacheable mapping file.
xmlFile
- The name of the file to be added. This must be in a form
useable to simply construct a java.io.File
instance.
- this (for method chaining purposes)
MappingException
- Indicates problems reading the cached file or processing
the non-cached file.
addCacheableFile(java.io.File)
addClass
public Configuration addClass(Class persistentClass)
throws MappingException
Read a mapping as an application resouurce using the convention that a class
named foo.bar.Foo is mapped by a file foo/bar/Foo.hbm.xml
which can be resolved as a classpath resource.
persistentClass
- The mapped class
- this (for method chaining purposes)
MappingException
- Indicates problems locating the resource or
processing the contained mapping document.
addDirectory
public Configuration addDirectory(File dir)
throws MappingException
Read all mapping documents from a directory tree.
Assumes that any file named
*.hbm.xml is a mapping document.
- this (for method chaining purposes)
MappingException
- Indicates problems reading the jar file or
processing the contained mapping documents.
addDocument
public Configuration addDocument(Document doc)
throws MappingException
Read mappings from a DOM Document
- this (for method chaining purposes)
MappingException
- Indicates problems reading the DOM or processing
the mapping document.
addFile
public Configuration addFile(File xmlFile)
throws MappingException
Read mappings from a particular XML file
xmlFile
- a path to a file
- this (for method chaining purposes)
MappingException
- Indicates inability to locate or parse
the specified mapping file.
addFile
public Configuration addFile(String xmlFile)
throws MappingException
Read mappings from a particular XML file
xmlFile
- a path to a file
- this (for method chaining purposes)
MappingException
- Indicates inability to locate or parse
the specified mapping file.
addInputStream
public Configuration addInputStream(InputStream xmlInputStream)
throws MappingException
Read mappings from an java.io.InputStream
.
xmlInputStream
- The input stream containing a DOM.
- this (for method chaining purposes)
MappingException
- Indicates problems reading the stream, or
processing the contained mapping document.
addJar
public Configuration addJar(File jar)
throws MappingException
Read all mappings from a jar file
Assumes that any file named
*.hbm.xml is a mapping document.
- this (for method chaining purposes)
MappingException
- Indicates problems reading the jar file or
processing the contained mapping documents.
addProperties
public Configuration addProperties(Properties extraProperties)
Set the given properties
addResource
public Configuration addResource(String resourceName)
throws MappingException
Read mappings as a application resourceName (i.e. classpath lookup)
trying different classloaders.
resourceName
- The resource name
- this (for method chaining purposes)
MappingException
- Indicates problems locating the resource or
processing the contained mapping document.
addResource
public Configuration addResource(String resourceName,
ClassLoader classLoader)
throws MappingException
Read mappings as a application resource (i.e. classpath lookup).
resourceName
- The resource nameclassLoader
- The class loader to use.
- this (for method chaining purposes)
MappingException
- Indicates problems locating the resource or
processing the contained mapping document.
addSqlFunction
public void addSqlFunction(String functionName,
SQLFunction function)
addURL
public Configuration addURL(URL url)
throws MappingException
Read mappings from a URL
url
- The url for the mapping document to be read.
- this (for method chaining purposes)
MappingException
- Indicates problems reading the URL or processing
the mapping document.
buildMapping
public Mapping buildMapping()
buildMappings
public void buildMappings()
Call this to ensure the mappings are fully compiled/built. Usefull to ensure getting
access to all information in the metamodel when calling e.g. getClassMappings().
buildSessionFactory
public SessionFactory buildSessionFactory()
throws HibernateException
Instantiate a new SessionFactory, using the properties and
mappings in this configuration. The SessionFactory will be
immutable, so changes made to the Configuration after
building the SessionFactory will not affect it.
- a new factory for Sessions
buildSettings
public Settings buildSettings()
throws HibernateException
Create an object-oriented view of the configuration properties
configure
public Configuration configure()
throws HibernateException
Use the mappings and properties specified in an application
resource named hibernate.cfg.xml.
configure
public Configuration configure(Document document)
throws HibernateException
Use the mappings and properties specified in the given XML document.
The format of the file is defined in
hibernate-configuration-3.0.dtd.
document
- an XML document from which you wish to load the configuration
- A configuration configured via the Document
configure
public Configuration configure(File configFile)
throws HibernateException
Use the mappings and properties specified in the given application
file. The format of the file is defined in
hibernate-configuration-3.0.dtd.
configFile
- File from which you wish to load the configuration
- A configuration configured via the file
configure
public Configuration configure(String resource)
throws HibernateException
Use the mappings and properties specified in the given application
resource. The format of the resource is defined in
hibernate-configuration-3.0.dtd.
The resource is found via
getConfigurationInputStream(resource).
configure
public Configuration configure(URL url)
throws HibernateException
Use the mappings and properties specified in the given document.
The format of the document is defined in
hibernate-configuration-3.0.dtd.
url
- URL from which you wish to load the configuration
- A configuration configured via the file
createMappings
public Mappings createMappings()
Create a new Mappings to add class and collection
mappings to.
doConfigure
protected Configuration doConfigure(InputStream stream,
String resourceName)
throws HibernateException
Use the mappings and properties specified in the given application
resource. The format of the resource is defined in
hibernate-configuration-3.0.dtd.
stream
- Inputstream to be read fromresourceName
- The name to use in warning/error messages
- A configuration configured via the stream
findPossibleExtends
protected org.dom4j.Document findPossibleExtends()
Find the first possible element in the queue of extends.
generateDropSchemaScript
public String[] generateDropSchemaScript(Dialect dialect)
throws HibernateException
Generate DDL for dropping tables
generateSchemaCreationScript
public String[] generateSchemaCreationScript(Dialect dialect)
throws HibernateException
Generate DDL for creating tables
getClassMapping
public PersistentClass getClassMapping(String entityName)
Get the mapping for a particular entity
entityName
- An entity name.
- the entity mapping information
getClassMappings
public Iterator getClassMappings()
Iterate the entity mappings
- Iterator of the entity mappings currently contained in the configuration.
getCollectionMapping
public Collection getCollectionMapping(String role)
Get the mapping for a particular collection role
- The collection mapping information
getCollectionMappings
public Iterator getCollectionMappings()
Iterate the collection mappings
- Iterator of the collection mappings currently contained in the configuration.
getConfigurationInputStream
protected InputStream getConfigurationInputStream(String resource)
throws HibernateException
Get the configuration file as an InputStream. Might be overridden
by subclasses to allow the configuration to be located by some arbitrary
mechanism.
getEntityNotFoundDelegate
public EntityNotFoundDelegate getEntityNotFoundDelegate()
Retrieve the user-supplied delegate to handle non-existent entity
scenarios. May be null.
- The user-supplied delegate
getEntityResolver
public EntityResolver getEntityResolver()
getFilterDefinitions
public Map getFilterDefinitions()
getImports
public Map getImports()
Get the query language imports
- a mapping from "import" names to fully qualified class names
getInterceptor
public Interceptor getInterceptor()
Return the configured Interceptor
getNamedQueries
public Map getNamedQueries()
Get the named queries
getNamedSQLQueries
public Map getNamedSQLQueries()
getProperties
public Properties getProperties()
Get all properties
getProperty
public String getProperty(String propertyName)
Get a property
getSqlFunctions
public Map getSqlFunctions()
getSqlResultSetMappings
public Map getSqlResultSetMappings()
getTableMappings
public Iterator getTableMappings()
Iterate the table mappings
- Iterator of the table mappings currently contained in the configuration.
mergeProperties
public Configuration mergeProperties(Properties properties)
Adds the incoming properties to the internap properties structure,
as long as the internal structure does not already contain an
entry for the given key.
parseMappingElement
protected void parseMappingElement(Element subelement,
String name)
reset
protected void reset()
secondPassCompileForeignKeys
protected void secondPassCompileForeignKeys(Table table,
Set done)
throws MappingException
setCacheConcurrencyStrategy
public Configuration setCacheConcurrencyStrategy(String clazz,
String concurrencyStrategy)
throws MappingException
Set up a cache for an entity class
clazz
- concurrencyStrategy
-
setCacheConcurrencyStrategy
public void setCacheConcurrencyStrategy(String clazz,
String concurrencyStrategy,
String region)
throws MappingException
setCollectionCacheConcurrencyStrategy
public Configuration setCollectionCacheConcurrencyStrategy(String collectionRole,
String concurrencyStrategy)
throws MappingException
Set up a cache for a collection role
collectionRole
- concurrencyStrategy
-
setCollectionCacheConcurrencyStrategy
public void setCollectionCacheConcurrencyStrategy(String collectionRole,
String concurrencyStrategy,
String region)
throws MappingException
setEntityNotFoundDelegate
public void setEntityNotFoundDelegate(EntityNotFoundDelegate entityNotFoundDelegate)
Specify a user-supplied delegate to be used to handle scenarios where an entity could not be
located by specified id. This is mainly intended for EJB3 implementations to be able to
control how proxy initialization errors should be handled...
entityNotFoundDelegate
- The delegate to use
setEntityResolver
public void setEntityResolver(EntityResolver entityResolver)
Set a custom entity resolver. This entity resolver must be
set before addXXX(misc) call.
Default value is
DTDEntityResolver
entityResolver
- entity resolver to use
setListener
public void setListener(String type,
Object listener)
setListener
public void setListener(String type,
String listener)
setListeners
public void setListeners(String type,
Object[] listeners)
setListeners
public void setListeners(String type,
String[] listenerClasses)
setNamingStrategy
public Configuration setNamingStrategy(NamingStrategy namingStrategy)
Set a custom naming strategy
namingStrategy
- the NamingStrategy to set
setProperties
public Configuration setProperties(Properties properties)
Specify a completely new set of properties
setProperty
public Configuration setProperty(String propertyName,
String value)
Set a property