org.hibernate.cfg
Class AnnotationConfiguration

java.lang.Object
  extended by org.hibernate.cfg.Configuration
      extended by org.hibernate.cfg.AnnotationConfiguration
All Implemented Interfaces:
Serializable

Deprecated. All functionality has been moved to Configuration

@Deprecated
public class AnnotationConfiguration
extends Configuration

Similar to the Configuration object but handles EJB3 and Hibernate specific annotations as a metadata facility.

See Also:
Serialized Form

Nested Class Summary
protected  class AnnotationConfiguration.ExtendedMappingsImpl
          Deprecated. 
 
Nested classes/interfaces inherited from class org.hibernate.cfg.Configuration
Configuration.MappingsImpl, Configuration.MetadataSourceQueue
 
Field Summary
 
Fields inherited from class org.hibernate.cfg.Configuration
ARTEFACT_PROCESSING_ORDER, auxiliaryDatabaseObjects, classes, collections, columnNameBindingPerTable, DEFAULT_ARTEFACT_PROCESSING_ORDER, DEFAULT_CACHE_CONCURRENCY_STRATEGY, extendsQueue, fetchProfiles, filterDefinitions, imports, metadataSourceQueue, namedQueries, namedSqlQueries, namingStrategy, propertyReferences, secondPasses, settingsFactory, sqlFunctions, sqlResultSetMappings, tableNameBinding, tables, typeDefs, USE_NEW_ID_GENERATOR_MAPPINGS, xmlHelper
 
Constructor Summary
AnnotationConfiguration()
          Deprecated.  
 
Method Summary
 AnnotationConfiguration addAnnotatedClass(Class annotatedClass)
          Deprecated. Read metadata from the annotations associated with this class.
 AnnotationConfiguration addCacheableFile(File xmlFile)
          Deprecated. Add a cached mapping file.
 AnnotationConfiguration addCacheableFile(String xmlFile)
          Deprecated. Add a cacheable mapping file.
 AnnotationConfiguration addClass(Class persistentClass)
          Deprecated. Read a mapping as an application resource 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.
 AnnotationConfiguration addDirectory(File dir)
          Deprecated. Read all mapping documents from a directory tree.
 AnnotationConfiguration addDocument(Document doc)
          Deprecated. Read mappings from a DOM Document
 AnnotationConfiguration addFile(File xmlFile)
          Deprecated. Read mappings from a particular XML file
 AnnotationConfiguration addFile(String xmlFile)
          Deprecated. Read mappings from a particular XML file
 AnnotationConfiguration addJar(File jar)
          Deprecated. Read all mappings from a jar file

Assumes that any file named *.hbm.xml is a mapping document.

 AnnotationConfiguration addPackage(String packageName)
          Deprecated. Read package-level metadata.
 AnnotationConfiguration addProperties(Properties extraProperties)
          Deprecated. Add the given properties to ours.
 AnnotationConfiguration addResource(String resourceName)
          Deprecated. Read mappings as a application resourceName (i.e.
 AnnotationConfiguration addResource(String resourceName, ClassLoader classLoader)
          Deprecated. Read mappings as a application resource (i.e.
 AnnotationConfiguration addURL(URL url)
          Deprecated. Read mappings from a URL
 AnnotationConfiguration addXML(String xml)
          Deprecated. Read mappings from a String
 AnnotationConfiguration configure()
          Deprecated. Use the mappings and properties specified in an application resource named hibernate.cfg.xml.
 AnnotationConfiguration configure(Document document)
          Deprecated. Use the mappings and properties specified in the given XML document.
 AnnotationConfiguration configure(File configFile)
          Deprecated. Use the mappings and properties specified in the given application file.
 AnnotationConfiguration configure(String resource)
          Deprecated. Use the mappings and properties specified in the given application resource.
 AnnotationConfiguration configure(URL url)
          Deprecated. Use the mappings and properties specified in the given document.
 ExtendedMappings createExtendedMappings()
          Deprecated.  
protected  AnnotationConfiguration doConfigure(org.dom4j.Document doc)
          Deprecated. Parse a dom4j document conforming to the Hibernate Configuration DTD (hibernate-configuration-3.0.dtd) and use its information to configure this Configuration's state
protected  AnnotationConfiguration doConfigure(InputStream stream, String resourceName)
          Deprecated. Configure this configuration's state from the contents of the given input stream.
 AnnotationConfiguration mergeProperties(Properties properties)
          Deprecated. Adds the incoming properties to the internal properties structure, as long as the internal structure does not already contain an entry for the given key.
 AnnotationConfiguration setCacheConcurrencyStrategy(String clazz, String concurrencyStrategy)
          Deprecated. Set up a cache for an entity class
 AnnotationConfiguration setCacheConcurrencyStrategy(String clazz, String concurrencyStrategy, String region)
          Deprecated. Set up a cache for an entity class, giving an explicit region name
 AnnotationConfiguration setCollectionCacheConcurrencyStrategy(String collectionRole, String concurrencyStrategy)
          Deprecated. Set up a cache for a collection role
 AnnotationConfiguration setInterceptor(Interceptor interceptor)
          Deprecated. Set the current Interceptor
 AnnotationConfiguration setNamingStrategy(NamingStrategy namingStrategy)
          Deprecated. Set a custom naming strategy
 AnnotationConfiguration setProperties(Properties properties)
          Deprecated. Specify a completely new set of properties
 AnnotationConfiguration setProperty(String propertyName, String value)
          Deprecated. Set a property value by name
 
Methods inherited from class org.hibernate.cfg.Configuration
add, addAuxiliaryDatabaseObject, addCacheableFileStrictly, addFetchProfile, addFilterDefinition, addInputStream, addSqlFunction, buildMapping, buildMappings, buildSessionFactory, buildSessionFactory, buildSettings, buildSettings, createMappings, findPossibleExtends, generateDropSchemaScript, generateSchemaCreationScript, generateSchemaUpdateScript, getClassMapping, getClassMappings, getCollectionMapping, getCollectionMappings, getConfigurationInputStream, getCurrentTenantIdentifierResolver, getEntityNotFoundDelegate, getEntityResolver, getEntityTuplizerFactory, getFilterDefinitions, getIdentifierGeneratorFactory, getImports, getInterceptor, getMappedSuperclassMappings, getNamedQueries, getNamedSQLQueries, getNamingStrategy, getProperties, getProperty, getReflectionManager, getSessionFactoryObserver, getSqlFunctions, getSqlResultSetMappings, getTableMappings, getTypeResolver, iterateFetchProfiles, registerTypeOverride, registerTypeOverride, registerTypeOverride, reset, secondPassCompile, secondPassCompileForeignKeys, setCacheConcurrencyStrategy, setCollectionCacheConcurrencyStrategy, setCurrentTenantIdentifierResolver, setEntityNotFoundDelegate, setEntityResolver, setPrecedence, setSessionFactoryObserver, validateSchema
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationConfiguration

public AnnotationConfiguration()
Deprecated. 
Method Detail

addAnnotatedClass

public AnnotationConfiguration addAnnotatedClass(Class annotatedClass)
                                          throws MappingException
Deprecated. 
Read metadata from the annotations associated with this class.

Overrides:
addAnnotatedClass in class Configuration
Parameters:
annotatedClass - The class containing annotations
Returns:
this (for method chaining)
Throws:
MappingException

addPackage

public AnnotationConfiguration addPackage(String packageName)
                                   throws MappingException
Deprecated. 
Read package-level metadata.

Overrides:
addPackage in class Configuration
Parameters:
packageName - java package name
Returns:
this (for method chaining)
Throws:
MappingException - in case there is an error in the mapping data

createExtendedMappings

public ExtendedMappings createExtendedMappings()
Deprecated. 

addFile

public AnnotationConfiguration addFile(String xmlFile)
                                throws MappingException
Deprecated. 
Description copied from class: Configuration
Read mappings from a particular XML file

Overrides:
addFile in class Configuration
Parameters:
xmlFile - a path to a file
Returns:
this (for method chaining purposes)
Throws:
MappingException - Indicates inability to locate or parse the specified mapping file.
See Also:
Configuration.addFile(java.io.File)

addFile

public AnnotationConfiguration addFile(File xmlFile)
                                throws MappingException
Deprecated. 
Description copied from class: Configuration
Read mappings from a particular XML file

Overrides:
addFile in class Configuration
Parameters:
xmlFile - a path to a file
Returns:
this (for method chaining purposes)
Throws:
MappingException - Indicates inability to locate the specified mapping file. Historically this could have indicated a problem parsing the XML document, but that is now delayed until after Configuration.buildMappings()

addCacheableFile

public AnnotationConfiguration addCacheableFile(File xmlFile)
                                         throws MappingException
Deprecated. 
Description copied from class: Configuration
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.

Overrides:
addCacheableFile in class Configuration
Parameters:
xmlFile - The cacheable mapping file to be added.
Returns:
this (for method chaining purposes)
Throws:
MappingException - Indicates problems reading the cached file or processing the non-cached file.

addCacheableFile

public AnnotationConfiguration addCacheableFile(String xmlFile)
                                         throws MappingException
Deprecated. 
Description copied from class: Configuration
Add a cacheable mapping file.

Overrides:
addCacheableFile in class Configuration
Parameters:
xmlFile - The name of the file to be added. This must be in a form useable to simply construct a File instance.
Returns:
this (for method chaining purposes)
Throws:
MappingException - Indicates problems reading the cached file or processing the non-cached file.
See Also:
Configuration.addCacheableFile(java.io.File)

addXML

public AnnotationConfiguration addXML(String xml)
                               throws MappingException
Deprecated. 
Description copied from class: Configuration
Read mappings from a String

Overrides:
addXML in class Configuration
Parameters:
xml - an XML string
Returns:
this (for method chaining purposes)
Throws:
MappingException - Indicates problems parsing the given XML string

addURL

public AnnotationConfiguration addURL(URL url)
                               throws MappingException
Deprecated. 
Description copied from class: Configuration
Read mappings from a URL

Overrides:
addURL in class Configuration
Parameters:
url - The url for the mapping document to be read.
Returns:
this (for method chaining purposes)
Throws:
MappingException - Indicates problems reading the URL or processing the mapping document.

addResource

public AnnotationConfiguration addResource(String resourceName,
                                           ClassLoader classLoader)
                                    throws MappingException
Deprecated. 
Description copied from class: Configuration
Read mappings as a application resource (i.e. classpath lookup).

Overrides:
addResource in class Configuration
Parameters:
resourceName - The resource name
classLoader - The class loader to use.
Returns:
this (for method chaining purposes)
Throws:
MappingException - Indicates problems locating the resource or processing the contained mapping document.

addDocument

public AnnotationConfiguration addDocument(Document doc)
                                    throws MappingException
Deprecated. 
Description copied from class: Configuration
Read mappings from a DOM Document

Overrides:
addDocument in class Configuration
Parameters:
doc - The DOM document
Returns:
this (for method chaining purposes)
Throws:
MappingException - Indicates problems reading the DOM or processing the mapping document.

addResource

public AnnotationConfiguration addResource(String resourceName)
                                    throws MappingException
Deprecated. 
Description copied from class: Configuration
Read mappings as a application resourceName (i.e. classpath lookup) trying different class loaders.

Overrides:
addResource in class Configuration
Parameters:
resourceName - The resource name
Returns:
this (for method chaining purposes)
Throws:
MappingException - Indicates problems locating the resource or processing the contained mapping document.

addClass

public AnnotationConfiguration addClass(Class persistentClass)
                                 throws MappingException
Deprecated. 
Description copied from class: Configuration
Read a mapping as an application resource 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.

Overrides:
addClass in class Configuration
Parameters:
persistentClass - The mapped class
Returns:
this (for method chaining purposes)
Throws:
MappingException - Indicates problems locating the resource or processing the contained mapping document.

addJar

public AnnotationConfiguration addJar(File jar)
                               throws MappingException
Deprecated. 
Description copied from class: Configuration
Read all mappings from a jar file

Assumes that any file named *.hbm.xml is a mapping document.

Overrides:
addJar in class Configuration
Parameters:
jar - a jar file
Returns:
this (for method chaining purposes)
Throws:
MappingException - Indicates problems reading the jar file or processing the contained mapping documents.

addDirectory

public AnnotationConfiguration addDirectory(File dir)
                                     throws MappingException
Deprecated. 
Description copied from class: Configuration
Read all mapping documents from a directory tree.

Assumes that any file named *.hbm.xml is a mapping document.

Overrides:
addDirectory in class Configuration
Parameters:
dir - The directory
Returns:
this (for method chaining purposes)
Throws:
MappingException - Indicates problems reading the jar file or processing the contained mapping documents.

setInterceptor

public AnnotationConfiguration setInterceptor(Interceptor interceptor)
Deprecated. 
Description copied from class: Configuration
Set the current Interceptor

Overrides:
setInterceptor in class Configuration
Parameters:
interceptor - The Interceptor to use for the built SessionFactory.
Returns:
this for method chaining

setProperties

public AnnotationConfiguration setProperties(Properties properties)
Deprecated. 
Description copied from class: Configuration
Specify a completely new set of properties

Overrides:
setProperties in class Configuration
Parameters:
properties - The new set of properties
Returns:
this for method chaining

addProperties

public AnnotationConfiguration addProperties(Properties extraProperties)
Deprecated. 
Description copied from class: Configuration
Add the given properties to ours.

Overrides:
addProperties in class Configuration
Parameters:
extraProperties - The properties to add.
Returns:
this for method chaining

mergeProperties

public AnnotationConfiguration mergeProperties(Properties properties)
Deprecated. 
Description copied from class: Configuration
Adds the incoming properties to the internal properties structure, as long as the internal structure does not already contain an entry for the given key.

Overrides:
mergeProperties in class Configuration
Parameters:
properties - The properties to merge
Returns:
this for ethod chaining

setProperty

public AnnotationConfiguration setProperty(String propertyName,
                                           String value)
Deprecated. 
Description copied from class: Configuration
Set a property value by name

Overrides:
setProperty in class Configuration
Parameters:
propertyName - The name of the property to set
value - The new property value
Returns:
this for method chaining

configure

public AnnotationConfiguration configure()
                                  throws HibernateException
Deprecated. 
Description copied from class: Configuration
Use the mappings and properties specified in an application resource named hibernate.cfg.xml.

Overrides:
configure in class Configuration
Returns:
this for method chaining
Throws:
HibernateException - Generally indicates we cannot find hibernate.cfg.xml
See Also:
Configuration.configure(String)

configure

public AnnotationConfiguration configure(String resource)
                                  throws HibernateException
Deprecated. 
Description copied from class: Configuration
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 Configuration.getConfigurationInputStream(java.lang.String)

Overrides:
configure in class Configuration
Parameters:
resource - The resource to use
Returns:
this for method chaining
Throws:
HibernateException - Generally indicates we cannot find the named resource
See Also:
Configuration.doConfigure(java.io.InputStream, String)

configure

public AnnotationConfiguration configure(URL url)
                                  throws HibernateException
Deprecated. 
Description copied from class: Configuration
Use the mappings and properties specified in the given document. The format of the document is defined in hibernate-configuration-3.0.dtd.

Overrides:
configure in class Configuration
Parameters:
url - URL from which you wish to load the configuration
Returns:
this for method chaining
Throws:
HibernateException - Generally indicates a problem access the url
See Also:
Configuration.doConfigure(java.io.InputStream, String)

configure

public AnnotationConfiguration configure(File configFile)
                                  throws HibernateException
Deprecated. 
Description copied from class: Configuration
Use the mappings and properties specified in the given application file. The format of the file is defined in hibernate-configuration-3.0.dtd.

Overrides:
configure in class Configuration
Parameters:
configFile - File from which you wish to load the configuration
Returns:
this for method chaining
Throws:
HibernateException - Generally indicates a problem access the file
See Also:
Configuration.doConfigure(java.io.InputStream, String)

doConfigure

protected AnnotationConfiguration doConfigure(InputStream stream,
                                              String resourceName)
                                       throws HibernateException
Deprecated. 
Description copied from class: Configuration
Configure this configuration's state from the contents of the given input stream. The expectation is that the stream contents represent an XML document conforming to the Hibernate Configuration DTD. See Configuration.doConfigure(Document) for further details.

Overrides:
doConfigure in class Configuration
Parameters:
stream - The input stream from which to read
resourceName - The name to use in warning/error messages
Returns:
this for method chaining
Throws:
HibernateException - Indicates a problem reading the stream contents.

configure

public AnnotationConfiguration configure(Document document)
                                  throws HibernateException
Deprecated. 
Description copied from class: Configuration
Use the mappings and properties specified in the given XML document. The format of the file is defined in hibernate-configuration-3.0.dtd.

Overrides:
configure in class Configuration
Parameters:
document - an XML document from which you wish to load the configuration
Returns:
A configuration configured via the Document
Throws:
HibernateException - if there is problem in accessing the file.

doConfigure

protected AnnotationConfiguration doConfigure(org.dom4j.Document doc)
                                       throws HibernateException
Deprecated. 
Description copied from class: Configuration
Parse a dom4j document conforming to the Hibernate Configuration DTD (hibernate-configuration-3.0.dtd) and use its information to configure this Configuration's state

Overrides:
doConfigure in class Configuration
Parameters:
doc - The dom4j document
Returns:
this for method chaining
Throws:
HibernateException - Indicates a problem performing the configuration task

setCacheConcurrencyStrategy

public AnnotationConfiguration setCacheConcurrencyStrategy(String clazz,
                                                           String concurrencyStrategy)
Deprecated. 
Description copied from class: Configuration
Set up a cache for an entity class

Overrides:
setCacheConcurrencyStrategy in class Configuration
Parameters:
clazz - The name of the entity to which we shoudl associate these cache settings
concurrencyStrategy - The cache strategy to use
Returns:
this for method chaining

setCacheConcurrencyStrategy

public AnnotationConfiguration setCacheConcurrencyStrategy(String clazz,
                                                           String concurrencyStrategy,
                                                           String region)
Deprecated. 
Description copied from class: Configuration
Set up a cache for an entity class, giving an explicit region name

Overrides:
setCacheConcurrencyStrategy in class Configuration
Parameters:
clazz - The name of the entity to which we should associate these cache settings
concurrencyStrategy - The cache strategy to use
region - The name of the cache region to use
Returns:
this for method chaining

setCollectionCacheConcurrencyStrategy

public AnnotationConfiguration setCollectionCacheConcurrencyStrategy(String collectionRole,
                                                                     String concurrencyStrategy)
                                                              throws MappingException
Deprecated. 
Description copied from class: Configuration
Set up a cache for a collection role

Overrides:
setCollectionCacheConcurrencyStrategy in class Configuration
Parameters:
collectionRole - The name of the collection to which we should associate these cache settings
concurrencyStrategy - The cache strategy to use
Returns:
this for method chaining
Throws:
MappingException

setNamingStrategy

public AnnotationConfiguration setNamingStrategy(NamingStrategy namingStrategy)
Deprecated. 
Description copied from class: Configuration
Set a custom naming strategy

Overrides:
setNamingStrategy in class Configuration
Parameters:
namingStrategy - the NamingStrategy to set
Returns:
this for method chaining


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.