Class Configuration
- java.lang.Object
-
- org.hibernate.cfg.Configuration
-
public class Configuration extends Object
A convenience API making it easier to bootstrap an instance of Hibernate.An instance of
Configurationmay be obtained simply by instantiation, and may be used to aggregate:- configuration properties from various sources, and
- entity O/R mappings, defined in either annotated classes, or XML mapping documents.
Note that XML mappings may be expressed using the JPA
orm.xmlformat, or in Hibernate's legacy.hbm.xmlformat.Configuration properties are enumerated by
AvailableSettings.SessionFactory factory = new Configuration() // scan classes for mapping annotations .addAnnotatedClass(Item.class) .addAnnotatedClass(Bid.class) .addAnnotatedClass(User.class) // read package-level annotations of the named package .addPackage("org.hibernate.auction") // set a configuration property .setProperty(AvailableSettings.DATASOURCE, "java:comp/env/jdbc/test") .buildSessionFactory();In addition, there are convenience methods for adding attribute converters, type contributors, entity name resolvers, SQL function descriptors, and auxiliary database objects, for setting naming strategies and a tenant id resolver, and more.
Finally, an instance of
SessionFactoryBuilderis obtained by callingbuildSessionFactory().Ultimately, this class simply delegates to
MetadataBuilderandStandardServiceRegistryBuilderto actually do the hard work of building theSessionFactory. Programs may directly use the APIs defined underorg.hibernate.boot, as an alternative to using an instance of this class.- See Also:
SessionFactory,AvailableSettings,org.hibernate.boot
-
-
Field Summary
Fields Modifier and Type Field Description static StringARTEFACT_PROCESSING_ORDERDeprecated, for removal: This API element is subject to removal in a future version.
-
Constructor Summary
Constructors Constructor Description Configuration()Create a new instance, using a defaultBootstrapServiceRegistryand a newly instantiatedMetadataSources.Configuration(MetadataSources metadataSources)Create a new instance, using the givenMetadataSources, and aBootstrapServiceRegistryobtained from theMetadataSources.Configuration(BootstrapServiceRegistry serviceRegistry)Create a new instance, using the givenBootstrapServiceRegistryand a newly instantiatedMetadataSources.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ConfigurationaddAnnotatedClass(Class annotatedClass)Read metadata from the annotations associated with this class.ConfigurationaddAttributeConverter(AttributeConverter<?,?> attributeConverter)Adds anAttributeConverterinstance to this configuration.ConfigurationaddAttributeConverter(AttributeConverter<?,?> attributeConverter, boolean autoApply)Adds anAttributeConverterinstance to this configuration.ConfigurationaddAttributeConverter(Class<? extends AttributeConverter<?,?>> attributeConverterClass)Adds anAttributeConverterto this configuration.ConfigurationaddAttributeConverter(Class<? extends AttributeConverter<?,?>> attributeConverterClass, boolean autoApply)Adds anAttributeConverterto this configuration.ConfigurationaddAttributeConverter(ConverterDescriptor converterDescriptor)Adds anConverterDescriptorinstance to this configuration.ConfigurationaddAuxiliaryDatabaseObject(AuxiliaryDatabaseObject object)Adds anAuxiliaryDatabaseObjectto this configuration.ConfigurationaddCacheableFile(File xmlFile)Add a cacheable mapping file.ConfigurationaddCacheableFile(String xmlFile)Add a cacheable mapping file.ConfigurationaddCacheableFileStrictly(File xmlFile)INTENDED FOR TESTSUITE USE ONLY!ConfigurationaddClass(Class entityClass)Read a mapping as an application resource using the convention that a class namedfoo.bar.Foois mapped by a filefoo/bar/Foo.hbm.xmlwhich can be resolved as a classpath resource.ConfigurationaddDirectory(File dir)Read all.hbm.xmlmapping documents from a directory tree.ConfigurationaddEntityNameResolver(EntityNameResolver entityNameResolver)Add anEntityNameResolverto this configuration.ConfigurationaddFile(File xmlFile)Read mappings from a particular XML file.ConfigurationaddFile(String xmlFile)Read mappings from a particular XML fileConfigurationaddInputStream(InputStream xmlInputStream)Read mappings from anInputStream.ConfigurationaddJar(File jar)Read all.hbm.xmlmappings from a.jarfile.ConfigurationaddPackage(String packageName)Read package-level metadata.ConfigurationaddProperties(Properties properties)Add the given properties to ours.ConfigurationaddResource(String resourceName)Read mappings as an application resource name, that is, using a classpath lookup, trying different class loaders in turn.ConfigurationaddSqlFunction(String functionName, SqmFunctionDescriptor function)Adds a function descriptor to this configuration.ConfigurationaddURL(URL url)Read mappings from aURL.ConfigurationaddXmlMapping(Binding<?> binding)Read mappings that were parsed usinggetXmlMappingBinderAccess().SessionFactorybuildSessionFactory()Create aSessionFactoryusing the properties and mappings in this configuration.SessionFactorybuildSessionFactory(ServiceRegistry serviceRegistry)Create aSessionFactoryusing the properties and mappings in this configuration.Configurationconfigure()Use the mappings and properties specified in an application resource namedhibernate.cfg.xml.Configurationconfigure(File configFile)Use the mappings and properties specified in the given application file.Configurationconfigure(String resource)Use the mappings and properties specified in the given application resource.Configurationconfigure(URL url)Use the mappings and properties specified in the given document.ColumnOrderingStrategygetColumnOrderingStrategy()TheCustomEntityDirtinessStrategy, if any, that was added to this configuration.CurrentTenantIdentifierResolver<Object>getCurrentTenantIdentifierResolver()TheCurrentTenantIdentifierResolver, if any, that was added to this configuration.CustomEntityDirtinessStrategygetCustomEntityDirtinessStrategy()TheCustomEntityDirtinessStrategy, if any, that was added to this configuration.EntityNotFoundDelegategetEntityNotFoundDelegate()Retrieve the user-suppliedEntityNotFoundDelegate, ornullif no delegate has been specified.ImplicitNamingStrategygetImplicitNamingStrategy()TheImplicitNamingStrategy, if any, to use in this configuration.InterceptorgetInterceptor()Retrieve the configuredInterceptor.Collection<NamedEntityGraphDefinition>getNamedEntityGraphs()Map<String,NamedProcedureCallDefinition>getNamedProcedureCallMap()Map<String,NamedHqlQueryDefinition>getNamedQueries()Map<String,NamedNativeQueryDefinition>getNamedSQLQueries()PhysicalNamingStrategygetPhysicalNamingStrategy()ThePhysicalNamingStrategy, if any, to use in this configuration.PropertiesgetProperties()Get all propertiesStringgetProperty(String propertyName)Get a property value by nameSessionFactoryObservergetSessionFactoryObserver()TheSessionFactoryObserver, if any, that was added to this configuration.Map<String,SqmFunctionDescriptor>getSqlFunctions()Deprecated, for removal: This API element is subject to removal in a future version.Map<String,NamedResultSetMappingDescriptor>getSqlResultSetMappings()StandardServiceRegistryBuildergetStandardServiceRegistryBuilder()Intended for internal testing use only!!!StatementInspectorgetStatementInspector()TheStatementInspector, if any, that was added to this configuration.XmlMappingBinderAccessgetXmlMappingBinderAccess()An object capable of parsing XML mapping files that can then be passed toaddXmlMapping(Binding).ConfigurationmergeProperties(Properties properties)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.ConfigurationregisterFunctionContributor(FunctionContributor functionContributor)Add aFunctionContributorto this configuration.ConfigurationregisterTypeContributor(TypeContributor typeContributor)Add aTypeContributorto this configuration.ConfigurationregisterTypeOverride(BasicType<?> type)Register a type into the type registry, potentially replacing a previously registered type.ConfigurationregisterTypeOverride(UserType<?> type, String[] keys)Register a type into the type registry, potentially replacing a previously registered type.ConfigurationsetColumnOrderingStrategy(ColumnOrderingStrategy columnOrderingStrategy)Specify aCustomEntityDirtinessStrategyto be added to this configuration.ConfigurationsetCurrentTenantIdentifierResolver(CurrentTenantIdentifierResolver<Object> currentTenantIdentifierResolver)Specify aCurrentTenantIdentifierResolverto be added to this configuration.ConfigurationsetCustomEntityDirtinessStrategy(CustomEntityDirtinessStrategy customEntityDirtinessStrategy)Specify aCustomEntityDirtinessStrategyto be added to this configuration.ConfigurationsetEntityNotFoundDelegate(EntityNotFoundDelegate entityNotFoundDelegate)Specify a user-suppliedEntityNotFoundDelegateto be used to handle scenarios where an entity could not be located by specified id.ConfigurationsetImplicitNamingStrategy(ImplicitNamingStrategy implicitNamingStrategy)Set anImplicitNamingStrategyto use in this configuration.ConfigurationsetInterceptor(Interceptor interceptor)Set the currentInterceptor.ConfigurationsetPhysicalNamingStrategy(PhysicalNamingStrategy physicalNamingStrategy)Set aPhysicalNamingStrategyto use in this configuration.ConfigurationsetProperties(Properties properties)Specify a completely new set of propertiesConfigurationsetProperty(String propertyName, boolean value)Set a property to a boolean value by nameConfigurationsetProperty(String propertyName, int value)Set a property to an integer value by nameConfigurationsetProperty(String propertyName, Class<?> value)Set a property to a Java class nameConfigurationsetProperty(String propertyName, Enum<?> value)Set a property to the name of a value of an enumerated typeConfigurationsetProperty(String propertyName, String value)Set a property value by nameConfigurationsetSessionFactoryObserver(SessionFactoryObserver sessionFactoryObserver)Specify aSessionFactoryObserverto be added to this configuration.ConfigurationsetSharedCacheMode(SharedCacheMode sharedCacheMode)Sets theSharedCacheModeto use.ConfigurationsetStatementInspector(StatementInspector statementInspector)Specify aStatementInspectorto be added to this configuration.
-
-
-
Field Detail
-
ARTEFACT_PROCESSING_ORDER
@Deprecated(since="6", forRemoval=true) public static final String ARTEFACT_PROCESSING_ORDER
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Configuration
public Configuration()
Create a new instance, using a defaultBootstrapServiceRegistryand a newly instantiatedMetadataSources.This is the usual method of obtaining a
Configuration.
-
Configuration
public Configuration(BootstrapServiceRegistry serviceRegistry)
Create a new instance, using the givenBootstrapServiceRegistryand a newly instantiatedMetadataSources.
-
Configuration
public Configuration(MetadataSources metadataSources)
Create a new instance, using the givenMetadataSources, and aBootstrapServiceRegistryobtained from theMetadataSources.
-
-
Method Detail
-
getProperties
public Properties getProperties()
Get all properties- Returns:
- all properties
-
setProperties
public Configuration setProperties(Properties properties)
Specify a completely new set of properties- Parameters:
properties- The new set of properties- Returns:
thisfor method chaining
-
getProperty
public String getProperty(String propertyName)
Get a property value by name- Parameters:
propertyName- The name of the property- Returns:
- The value currently associated with that property name; may be null.
-
setProperty
public Configuration setProperty(String propertyName, String value)
Set a property value by name- Parameters:
propertyName- The name of the property to setvalue- The new property value- Returns:
thisfor method chaining
-
setProperty
public Configuration setProperty(String propertyName, boolean value)
Set a property to a boolean value by name- Parameters:
propertyName- The name of the property to setvalue- The new boolean property value- Returns:
thisfor method chaining- Since:
- 6.5
-
setProperty
public Configuration setProperty(String propertyName, Class<?> value)
Set a property to a Java class name- Parameters:
propertyName- The name of the property to setvalue- The Java class- Returns:
thisfor method chaining- Since:
- 6.5
-
setProperty
public Configuration setProperty(String propertyName, Enum<?> value)
Set a property to the name of a value of an enumerated type- Parameters:
propertyName- The name of the property to setvalue- A value of an enumerated type- Returns:
thisfor method chaining- Since:
- 6.5
-
setProperty
public Configuration setProperty(String propertyName, int value)
Set a property to an integer value by name- Parameters:
propertyName- The name of the property to setvalue- The new integer property value- Returns:
thisfor method chaining- Since:
- 6.5
-
addProperties
public Configuration addProperties(Properties properties)
Add the given properties to ours.- Parameters:
properties- The properties to add.- Returns:
thisfor method chaining
-
getImplicitNamingStrategy
public ImplicitNamingStrategy getImplicitNamingStrategy()
TheImplicitNamingStrategy, if any, to use in this configuration.
-
setImplicitNamingStrategy
public Configuration setImplicitNamingStrategy(ImplicitNamingStrategy implicitNamingStrategy)
Set anImplicitNamingStrategyto use in this configuration.- Returns:
thisfor method chaining
-
getPhysicalNamingStrategy
public PhysicalNamingStrategy getPhysicalNamingStrategy()
ThePhysicalNamingStrategy, if any, to use in this configuration.
-
setPhysicalNamingStrategy
public Configuration setPhysicalNamingStrategy(PhysicalNamingStrategy physicalNamingStrategy)
Set aPhysicalNamingStrategyto use in this configuration.- Returns:
thisfor method chaining
-
configure
public Configuration configure() throws HibernateException
Use the mappings and properties specified in an application resource namedhibernate.cfg.xml.- Returns:
thisfor method chaining- Throws:
HibernateException- Generally indicates we cannot findhibernate.cfg.xml- See Also:
configure(String)
-
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 by
hibernate-configuration-3.0.dtd.- Parameters:
resource- The resource to use- Returns:
thisfor method chaining- Throws:
HibernateException- Generally indicates we cannot find the named resource
-
getStandardServiceRegistryBuilder
@Internal public StandardServiceRegistryBuilder getStandardServiceRegistryBuilder()
Intended for internal testing use only!!!
-
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 by
hibernate-configuration-3.0.dtd.- Parameters:
url- URL from which you wish to load the configuration- Returns:
thisfor method chaining- Throws:
HibernateException- Generally indicates a problem access the url
-
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 by
hibernate-configuration-3.0.dtd.- Parameters:
configFile- File from which you wish to load the configuration- Returns:
thisfor method chaining- Throws:
HibernateException- Generally indicates a problem access the file
-
registerTypeContributor
public Configuration registerTypeContributor(TypeContributor typeContributor)
Add aTypeContributorto this configuration.- Returns:
thisfor method chaining
-
registerFunctionContributor
public Configuration registerFunctionContributor(FunctionContributor functionContributor)
Add aFunctionContributorto this configuration.- Returns:
thisfor method chaining
-
registerTypeOverride
public Configuration registerTypeOverride(BasicType<?> type)
Register a type into the type registry, potentially replacing a previously registered type.- Parameters:
type- The type to register.- Returns:
thisfor method chaining
-
registerTypeOverride
public Configuration registerTypeOverride(UserType<?> type, String[] keys)
Register a type into the type registry, potentially replacing a previously registered type.- Parameters:
type- The type to register.keys- The keys under which to register the type.- Returns:
thisfor method chaining
-
addFile
public Configuration addFile(String xmlFile) throws MappingException
Read mappings from a particular XML file- Parameters:
xmlFile- a path to a file- Returns:
thisfor method chaining- Throws:
MappingException- Indicates inability to locate or parse the specified mapping file.- See Also:
addFile(File)
-
addFile
public Configuration addFile(File xmlFile) throws MappingException
Read mappings from a particular XML file.- Parameters:
xmlFile- a path to a file- Returns:
thisfor method chaining- Throws:
MappingException- Indicates inability to locate the specified mapping file
-
getXmlMappingBinderAccess
public XmlMappingBinderAccess getXmlMappingBinderAccess()
An object capable of parsing XML mapping files that can then be passed toaddXmlMapping(Binding).
-
addXmlMapping
public Configuration addXmlMapping(Binding<?> binding)
Read mappings that were parsed usinggetXmlMappingBinderAccess().- Parameters:
binding- the parsed mapping- Returns:
thisfor method chaining
-
addCacheableFile
public Configuration addCacheableFile(File xmlFile) throws MappingException
Add a cacheable 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
If a cachedxmlFile + ".bin"wherexmlFileis the name of the original mapping file.xmlFile + ".bin"exists and is newer thanxmlFile, the".bin"file will be read directly. Otherwise,xmlFileis read and then serialized toxmlFile + ".bin"for use the next time.- Parameters:
xmlFile- The cacheable mapping file to be added.- Returns:
thisfor method chaining- Throws:
MappingException- Indicates problems reading the cached file or processing the non-cached file.
-
addCacheableFileStrictly
public Configuration addCacheableFileStrictly(File xmlFile) throws SerializationException
INTENDED FOR TESTSUITE USE ONLY!Much like
addCacheableFile(File)except that here we will fail immediately if the cache version cannot be found or used for whatever reason.- Parameters:
xmlFile- The xml file, not the bin!- Returns:
thisfor method chaining- Throws:
SerializationException- Indicates a problem deserializing the cached dom tree
-
addCacheableFile
public Configuration addCacheableFile(String xmlFile) throws MappingException
Add a cacheable mapping file.- Parameters:
xmlFile- The name of the file to be added, in a form usable to simply construct aFileinstance- Returns:
thisfor method chaining- Throws:
MappingException- Indicates problems reading the cached file or processing the non-cached file- See Also:
addCacheableFile(File)
-
addURL
public Configuration addURL(URL url) throws MappingException
Read mappings from aURL.- Parameters:
url- The url for the mapping document to be read.- Returns:
thisfor method chaining- Throws:
MappingException- Indicates problems reading the URL or processing the mapping document.
-
addInputStream
public Configuration addInputStream(InputStream xmlInputStream) throws MappingException
Read mappings from anInputStream.- Parameters:
xmlInputStream- The input stream containing a DOM.- Returns:
thisfor method chaining- Throws:
MappingException- Indicates problems reading the stream, or processing the contained mapping document.
-
addResource
public Configuration addResource(String resourceName) throws MappingException
Read mappings as an application resource name, that is, using a classpath lookup, trying different class loaders in turn.- Parameters:
resourceName- The resource name- Returns:
thisfor method chaining- Throws:
MappingException- Indicates problems locating the resource or processing the contained mapping document.
-
addClass
public Configuration addClass(Class entityClass) throws MappingException
Read a mapping as an application resource using the convention that a class namedfoo.bar.Foois mapped by a filefoo/bar/Foo.hbm.xmlwhich can be resolved as a classpath resource.- Parameters:
entityClass- The mapped class- Returns:
thisfor method chaining- Throws:
MappingException- Indicates problems locating the resource or processing the contained mapping document.
-
addAnnotatedClass
public Configuration addAnnotatedClass(Class annotatedClass)
Read metadata from the annotations associated with this class.- Parameters:
annotatedClass- The class containing annotations- Returns:
thisfor method chaining
-
addPackage
public Configuration addPackage(String packageName) throws MappingException
Read package-level metadata.- Parameters:
packageName- java package name- Returns:
thisfor method chaining- Throws:
MappingException- in case there is an error in the mapping data
-
addJar
public Configuration addJar(File jar) throws MappingException
Read all.hbm.xmlmappings from a.jarfile.Assumes that any file named
*.hbm.xmlis a mapping document. This method does not supportorm.xmlfiles!- Parameters:
jar- a jar file- Returns:
thisfor method chaining- Throws:
MappingException- Indicates problems reading the jar file or processing the contained mapping documents.
-
addDirectory
public Configuration addDirectory(File dir) throws MappingException
Read all.hbm.xmlmapping documents from a directory tree.Assumes that any file named
*.hbm.xmlis a mapping document. This method does not supportorm.xmlfiles!- Parameters:
dir- The directory- Returns:
thisfor method chaining- Throws:
MappingException- Indicates problems reading the jar file or processing the contained mapping documents.
-
getInterceptor
public Interceptor getInterceptor()
Retrieve the configuredInterceptor.- Returns:
- The current
Interceptor
-
setInterceptor
public Configuration setInterceptor(Interceptor interceptor)
Set the currentInterceptor.- Parameters:
interceptor- TheInterceptorto use- Returns:
thisfor method chaining
-
getEntityNotFoundDelegate
public EntityNotFoundDelegate getEntityNotFoundDelegate()
Retrieve the user-suppliedEntityNotFoundDelegate, ornullif no delegate has been specified.- Returns:
- The user-supplied delegate
-
setEntityNotFoundDelegate
public Configuration setEntityNotFoundDelegate(EntityNotFoundDelegate entityNotFoundDelegate)
Specify a user-suppliedEntityNotFoundDelegateto be used to handle scenarios where an entity could not be located by specified id.- Parameters:
entityNotFoundDelegate- The delegate to use- Returns:
thisfor method chaining
-
getSessionFactoryObserver
public SessionFactoryObserver getSessionFactoryObserver()
TheSessionFactoryObserver, if any, that was added to this configuration.
-
setSessionFactoryObserver
public Configuration setSessionFactoryObserver(SessionFactoryObserver sessionFactoryObserver)
Specify aSessionFactoryObserverto be added to this configuration.- Returns:
thisfor method chaining
-
getStatementInspector
public StatementInspector getStatementInspector()
TheStatementInspector, if any, that was added to this configuration.
-
setStatementInspector
public Configuration setStatementInspector(StatementInspector statementInspector)
Specify aStatementInspectorto be added to this configuration.- Returns:
thisfor method chaining
-
getCurrentTenantIdentifierResolver
public CurrentTenantIdentifierResolver<Object> getCurrentTenantIdentifierResolver()
TheCurrentTenantIdentifierResolver, if any, that was added to this configuration.
-
setCurrentTenantIdentifierResolver
public Configuration setCurrentTenantIdentifierResolver(CurrentTenantIdentifierResolver<Object> currentTenantIdentifierResolver)
Specify aCurrentTenantIdentifierResolverto be added to this configuration.- Returns:
thisfor method chaining
-
getCustomEntityDirtinessStrategy
public CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy()
TheCustomEntityDirtinessStrategy, if any, that was added to this configuration.
-
setCustomEntityDirtinessStrategy
public Configuration setCustomEntityDirtinessStrategy(CustomEntityDirtinessStrategy customEntityDirtinessStrategy)
Specify aCustomEntityDirtinessStrategyto be added to this configuration.- Returns:
thisfor method chaining
-
getColumnOrderingStrategy
@Incubating public ColumnOrderingStrategy getColumnOrderingStrategy()
TheCustomEntityDirtinessStrategy, if any, that was added to this configuration.
-
setColumnOrderingStrategy
@Incubating public Configuration setColumnOrderingStrategy(ColumnOrderingStrategy columnOrderingStrategy)
Specify aCustomEntityDirtinessStrategyto be added to this configuration.- Returns:
thisfor method chaining
-
buildSessionFactory
public SessionFactory buildSessionFactory(ServiceRegistry serviceRegistry) throws HibernateException
Create aSessionFactoryusing the properties and mappings in this configuration. TheSessionFactorywill be immutable, so changes made to thisConfigurationafter building the factory will not affect it.- Parameters:
serviceRegistry- The registry of services to be used in creating this session factory.- Returns:
- The newly-built
SessionFactory - Throws:
HibernateException- usually indicates an invalid configuration or invalid mapping information
-
buildSessionFactory
public SessionFactory buildSessionFactory() throws HibernateException
Create aSessionFactoryusing the properties and mappings in this configuration. TheSessionFactorywill be immutable, so changes made to thisConfigurationafter building the factory will not affect it.- Returns:
- The newly-built
SessionFactory - Throws:
HibernateException- usually indicates an invalid configuration or invalid mapping information
-
getSqlFunctions
@Deprecated(since="6.5", forRemoval=true) public Map<String,SqmFunctionDescriptor> getSqlFunctions()
Deprecated, for removal: This API element is subject to removal in a future version.
-
addSqlFunction
public Configuration addSqlFunction(String functionName, SqmFunctionDescriptor function)
Adds a function descriptor to this configuration.- Returns:
thisfor method chaining- See Also:
SqmFunctionDescriptor- API Note:
- For historical reasons, this method is misnamed. The function descriptor actually describes a function available in HQL, and it may or may not map directly to a function defined in SQL.
-
addAuxiliaryDatabaseObject
public Configuration addAuxiliaryDatabaseObject(AuxiliaryDatabaseObject object)
Adds anAuxiliaryDatabaseObjectto this configuration.- Returns:
thisfor method chaining
-
addAttributeConverter
public Configuration addAttributeConverter(Class<? extends AttributeConverter<?,?>> attributeConverterClass, boolean autoApply)
Adds anAttributeConverterto this configuration.- Parameters:
attributeConverterClass- TheAttributeConverterclass.autoApply- Should theAttributeConverterbe auto applied to property types as specified by its "entity attribute" parameterized type?- Returns:
thisfor method chaining
-
addAttributeConverter
public Configuration addAttributeConverter(Class<? extends AttributeConverter<?,?>> attributeConverterClass)
Adds anAttributeConverterto this configuration.- Parameters:
attributeConverterClass- TheAttributeConverterclass.- Returns:
thisfor method chaining
-
addAttributeConverter
public Configuration addAttributeConverter(AttributeConverter<?,?> attributeConverter)
Adds anAttributeConverterinstance to this configuration. This form is mainly intended for developers to programmatically add their ownAttributeConverterinstance.- Parameters:
attributeConverter- TheAttributeConverterinstance.- Returns:
thisfor method chaining
-
addAttributeConverter
public Configuration addAttributeConverter(AttributeConverter<?,?> attributeConverter, boolean autoApply)
Adds anAttributeConverterinstance to this configuration. This form is mainly intended for developers to programmatically add their ownAttributeConverterinstance.- Parameters:
attributeConverter- TheAttributeConverterinstance.autoApply- Should theAttributeConverterbe auto applied to property types as specified by its "entity attribute" parameterized type?- Returns:
thisfor method chaining
-
addAttributeConverter
public Configuration addAttributeConverter(ConverterDescriptor converterDescriptor)
Adds anConverterDescriptorinstance to this configuration.- Parameters:
converterDescriptor- TheConverterDescriptorinstance.- Returns:
thisfor method chaining
-
addEntityNameResolver
public Configuration addEntityNameResolver(EntityNameResolver entityNameResolver)
Add anEntityNameResolverto this configuration.- Parameters:
entityNameResolver- TheEntityNameResolverinstance.- Returns:
thisfor method chaining- Since:
- 6.2
-
setSharedCacheMode
public Configuration setSharedCacheMode(SharedCacheMode sharedCacheMode)
Sets theSharedCacheModeto use.Note that currently only
SharedCacheMode.ALLhas any effect onhbm.xmlbinding.- Parameters:
sharedCacheMode- The SharedCacheMode to use- Returns:
thisfor method chaining
-
getNamedSQLQueries
public Map<String,NamedNativeQueryDefinition> getNamedSQLQueries()
-
getSqlResultSetMappings
public Map<String,NamedResultSetMappingDescriptor> getSqlResultSetMappings()
-
getNamedEntityGraphs
public Collection<NamedEntityGraphDefinition> getNamedEntityGraphs()
-
getNamedQueries
public Map<String,NamedHqlQueryDefinition> getNamedQueries()
-
getNamedProcedureCallMap
public Map<String,NamedProcedureCallDefinition> getNamedProcedureCallMap()
-
mergeProperties
public Configuration mergeProperties(Properties properties)
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.- Parameters:
properties- The properties to merge- Returns:
thisfor method chaining
-
-