Package org.hibernate.cfg
Class AnnotationConfiguration
java.lang.Object
org.hibernate.cfg.Configuration
org.hibernate.cfg.AnnotationConfiguration
- All Implemented Interfaces:
Serializable
Deprecated.
Similar to the
Configuration object but handles EJB3 and Hibernate
specific annotations as a metadata facility.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classDeprecated.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
ConstructorsConstructorDescriptionDeprecated.Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionaddAnnotatedClass(Class annotatedClass) Deprecated.Read metadata from the annotations associated with this class.addCacheableFile(File xmlFile) Deprecated.Add a cached mapping file.addCacheableFile(String xmlFile) Deprecated.Add a cacheable mapping file.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.addDirectory(File dir) Deprecated.Read all mapping documents from a directory tree.addDocument(Document doc) Deprecated.Read mappings from a DOM DocumentDeprecated.Read mappings from a particular XML fileDeprecated.Read mappings from a particular XML fileDeprecated.Read all mappings from a jar fileaddPackage(String packageName) Deprecated.Read package-level metadata.addProperties(Properties extraProperties) Deprecated.Add the given properties to ours.addResource(String resourceName) Deprecated.Read mappings as a application resourceName (i.e.addResource(String resourceName, ClassLoader classLoader) Deprecated.Read mappings as a application resource (i.e.Deprecated.Read mappings from a URLDeprecated.Read mappings from a StringDeprecated.Use the mappings and properties specified in an application resource named hibernate.cfg.xml.Deprecated.Use the mappings and properties specified in the given application file.Deprecated.Use the mappings and properties specified in the given application resource.Deprecated.Use the mappings and properties specified in the given document.Deprecated.Use the mappings and properties specified in the given XML document.Deprecated.protected AnnotationConfigurationdoConfigure(InputStream stream, String resourceName) Deprecated.Configure this configuration's state from the contents of the given input stream.protected AnnotationConfigurationDeprecated.Parse a dom4j document conforming to the Hibernate Configuration DTD (hibernate-configuration-3.0.dtd) and use its information to configure thisConfiguration's statemergeProperties(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.setCacheConcurrencyStrategy(String clazz, String concurrencyStrategy) Deprecated.Set up a cache for an entity classsetCacheConcurrencyStrategy(String clazz, String concurrencyStrategy, String region) Deprecated.Set up a cache for an entity class, giving an explicit region namesetCollectionCacheConcurrencyStrategy(String collectionRole, String concurrencyStrategy) Deprecated.Set up a cache for a collection rolesetInterceptor(Interceptor interceptor) Deprecated.Set the currentInterceptorsetNamingStrategy(NamingStrategy namingStrategy) Deprecated.Set a custom naming strategysetPersisterClassProvider(PersisterClassProvider persisterClassProvider) Deprecated.Defines a custom persister class provider.setProperties(Properties properties) Deprecated.Specify a completely new set of propertiessetProperty(String propertyName, String value) Deprecated.Set a property value by nameMethods inherited from class org.hibernate.cfg.Configuration
add, addAuxiliaryDatabaseObject, addCacheableFileStrictly, addFetchProfile, addFilterDefinition, addInputStream, addSqlFunction, buildMapping, buildMappings, buildSessionFactory, buildSettings, buildSettings, createMappings, findPossibleExtends, generateDropSchemaScript, generateSchemaCreationScript, generateSchemaUpdateScript, getClassMapping, getClassMappings, getCollectionMapping, getCollectionMappings, getConfigurationInputStream, getEntityNotFoundDelegate, getEntityResolver, getEntityTuplizerFactory, getEventListeners, getFilterDefinitions, getIdentifierGeneratorFactory, getImports, getInterceptor, getMappedSuperclassMappings, getNamedQueries, getNamedSQLQueries, getNamingStrategy, getPersisterClassProvider, getProperties, getProperty, getReflectionManager, getSessionFactoryObserver, getSqlFunctions, getSqlResultSetMappings, getTableMappings, getTypeResolver, iterateFetchProfiles, registerTypeOverride, registerTypeOverride, registerTypeOverride, reset, secondPassCompile, secondPassCompileForeignKeys, setCacheConcurrencyStrategy, setCollectionCacheConcurrencyStrategy, setEntityNotFoundDelegate, setEntityResolver, setListener, setListener, setListeners, setListeners, setPrecedence, setSessionFactoryObserver, validateSchema
-
Constructor Details
-
AnnotationConfiguration
public AnnotationConfiguration()Deprecated. -
AnnotationConfiguration
Deprecated.
-
-
Method Details
-
addAnnotatedClass
Deprecated.Read metadata from the annotations associated with this class.- Overrides:
addAnnotatedClassin classConfiguration- Parameters:
annotatedClass- The class containing annotations- Returns:
- this (for method chaining)
- Throws:
MappingException
-
addPackage
Deprecated.Read package-level metadata.- Overrides:
addPackagein classConfiguration- Parameters:
packageName- java package name- Returns:
- this (for method chaining)
- Throws:
MappingException- in case there is an error in the mapping data
-
createExtendedMappings
Deprecated. -
addFile
Deprecated.Description copied from class:ConfigurationRead mappings from a particular XML file- Overrides:
addFilein classConfiguration- 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:
-
addFile
Deprecated.Description copied from class:ConfigurationRead mappings from a particular XML file- Overrides:
addFilein classConfiguration- 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 afterConfiguration.buildMappings()
-
addCacheableFile
Deprecated.Description copied from class:ConfigurationAdd 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:
addCacheableFilein classConfiguration- 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
Deprecated.Description copied from class:ConfigurationAdd a cacheable mapping file.- Overrides:
addCacheableFilein classConfiguration- Parameters:
xmlFile- The name of the file to be added. This must be in a form useable to simply construct aFileinstance.- Returns:
- this (for method chaining purposes)
- Throws:
MappingException- Indicates problems reading the cached file or processing the non-cached file.- See Also:
-
addXML
Deprecated.Description copied from class:ConfigurationRead mappings from a String- Overrides:
addXMLin classConfiguration- Parameters:
xml- an XML string- Returns:
- this (for method chaining purposes)
- Throws:
MappingException- Indicates problems parsing the given XML string
-
addURL
Deprecated.Description copied from class:ConfigurationRead mappings from a URL- Overrides:
addURLin classConfiguration- 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:ConfigurationRead mappings as a application resource (i.e. classpath lookup).- Overrides:
addResourcein classConfiguration- Parameters:
resourceName- The resource nameclassLoader- 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
Deprecated.Description copied from class:ConfigurationRead mappings from a DOM Document- Overrides:
addDocumentin classConfiguration- Parameters:
doc- The DOM document- Returns:
- this (for method chaining purposes)
- Throws:
MappingException- Indicates problems reading the DOM or processing the mapping document.
-
addResource
Deprecated.Description copied from class:ConfigurationRead mappings as a application resourceName (i.e. classpath lookup) trying different class loaders.- Overrides:
addResourcein classConfiguration- 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
Deprecated.Description copied from class:ConfigurationRead 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:
addClassin classConfiguration- 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
Deprecated.Description copied from class:ConfigurationRead all mappings from a jar file Assumes that any file named *.hbm.xml is a mapping document.- Overrides:
addJarin classConfiguration- 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
Deprecated.Description copied from class:ConfigurationRead all mapping documents from a directory tree. Assumes that any file named *.hbm.xml is a mapping document.- Overrides:
addDirectoryin classConfiguration- 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
Deprecated.Description copied from class:ConfigurationSet the currentInterceptor- Overrides:
setInterceptorin classConfiguration- Parameters:
interceptor- TheInterceptorto use for thebuiltSessionFactory.- Returns:
- this for method chaining
-
setProperties
Deprecated.Description copied from class:ConfigurationSpecify a completely new set of properties- Overrides:
setPropertiesin classConfiguration- Parameters:
properties- The new set of properties- Returns:
- this for method chaining
-
addProperties
Deprecated.Description copied from class:ConfigurationAdd the given properties to ours.- Overrides:
addPropertiesin classConfiguration- Parameters:
extraProperties- The properties to add.- Returns:
- this for method chaining
-
mergeProperties
Deprecated.Description copied from class:ConfigurationAdds 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:
mergePropertiesin classConfiguration- Parameters:
properties- The properties to merge- Returns:
- this for ethod chaining
-
setProperty
Deprecated.Description copied from class:ConfigurationSet a property value by name- Overrides:
setPropertyin classConfiguration- Parameters:
propertyName- The name of the property to setvalue- The new property value- Returns:
- this for method chaining
-
configure
Deprecated.Description copied from class:ConfigurationUse the mappings and properties specified in an application resource named hibernate.cfg.xml.- Overrides:
configurein classConfiguration- Returns:
- this for method chaining
- Throws:
HibernateException- Generally indicates we cannot find hibernate.cfg.xml- See Also:
-
configure
Deprecated.Description copied from class:ConfigurationUse 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 viaConfiguration.getConfigurationInputStream(java.lang.String)- Overrides:
configurein classConfiguration- Parameters:
resource- The resource to use- Returns:
- this for method chaining
- Throws:
HibernateException- Generally indicates we cannot find the named resource- See Also:
-
configure
Deprecated.Description copied from class:ConfigurationUse the mappings and properties specified in the given document. The format of the document is defined in hibernate-configuration-3.0.dtd.- Overrides:
configurein classConfiguration- 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:
-
configure
Deprecated.Description copied from class:ConfigurationUse the mappings and properties specified in the given application file. The format of the file is defined in hibernate-configuration-3.0.dtd.- Overrides:
configurein classConfiguration- 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:
-
doConfigure
protected AnnotationConfiguration doConfigure(InputStream stream, String resourceName) throws HibernateException Deprecated.Description copied from class:ConfigurationConfigure 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. SeeConfiguration.doConfigure(Document)for further details.- Overrides:
doConfigurein classConfiguration- Parameters:
stream- The input stream from which to readresourceName- The name to use in warning/error messages- Returns:
- this for method chaining
- Throws:
HibernateException- Indicates a problem reading the stream contents.
-
configure
Deprecated.Description copied from class:ConfigurationUse the mappings and properties specified in the given XML document. The format of the file is defined in hibernate-configuration-3.0.dtd.- Overrides:
configurein classConfiguration- 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
Deprecated.Description copied from class:ConfigurationParse a dom4j document conforming to the Hibernate Configuration DTD (hibernate-configuration-3.0.dtd) and use its information to configure thisConfiguration's state- Overrides:
doConfigurein classConfiguration- 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:ConfigurationSet up a cache for an entity class- Overrides:
setCacheConcurrencyStrategyin classConfiguration- Parameters:
clazz- The name of the entity to which we shoudl associate these cache settingsconcurrencyStrategy- 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:ConfigurationSet up a cache for an entity class, giving an explicit region name- Overrides:
setCacheConcurrencyStrategyin classConfiguration- Parameters:
clazz- The name of the entity to which we should associate these cache settingsconcurrencyStrategy- The cache strategy to useregion- 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:ConfigurationSet up a cache for a collection role- Overrides:
setCollectionCacheConcurrencyStrategyin classConfiguration- Parameters:
collectionRole- The name of the collection to which we should associate these cache settingsconcurrencyStrategy- The cache strategy to use- Returns:
- this for method chaining
- Throws:
MappingException
-
setNamingStrategy
Deprecated.Description copied from class:ConfigurationSet a custom naming strategy- Overrides:
setNamingStrategyin classConfiguration- Parameters:
namingStrategy- the NamingStrategy to set- Returns:
- this for method chaining
-
setPersisterClassProvider
public AnnotationConfiguration setPersisterClassProvider(PersisterClassProvider persisterClassProvider) Deprecated.Description copied from class:ConfigurationDefines a custom persister class provider. The persister class is chosen according to the following rules in decreasing priority: - the persister class defined explicitly via annotation or XML - the persister class returned by the PersisterClassProvider implementation (if not null) - the default provider as chosen by Hibernate Core (best choice most of the time)- Overrides:
setPersisterClassProviderin classConfiguration- Parameters:
persisterClassProvider- implementation
-
Configuration