public class LocalXSessionFactoryBuilder extends Configuration
ARTEFACT_PROCESSING_ORDER, auxiliaryDatabaseObjects, classes, collections, columnNameBindingPerTable, DEFAULT_ARTEFACT_PROCESSING_ORDER, DEFAULT_CACHE_CONCURRENCY_STRATEGY, extendsQueue, fetchProfiles, filterDefinitions, imports, metadataSourceQueue, namedEntityGraphMap, namedProcedureCallMap, namedQueries, namedSqlQueries, namingStrategy, propertyReferences, secondPasses, settingsFactory, sqlFunctions, sqlResultSetMappings, tableNameBinding, tables, typeDefs, USE_NEW_ID_GENERATOR_MAPPINGS, xmlHelper| Constructor and Description |
|---|
LocalXSessionFactoryBuilder(DataSource dataSource)
Create a new LocalSessionFactoryBuilder for the given DataSource.
|
LocalXSessionFactoryBuilder(DataSource dataSource,
ClassLoader classLoader)
Create a new LocalSessionFactoryBuilder for the given DataSource.
|
LocalXSessionFactoryBuilder(DataSource dataSource,
org.springframework.core.io.ResourceLoader resourceLoader)
Create a new LocalSessionFactoryBuilder for the given DataSource.
|
| Modifier and Type | Method and Description |
|---|---|
LocalXSessionFactoryBuilder |
addAnnotatedClasses(Class<?>... annotatedClasses)
Add the given annotated classes in a batch.
|
LocalXSessionFactoryBuilder |
addPackages(String... annotatedPackages)
Add the given annotated packages in a batch.
|
XSessionFactory |
buildSessionFactory()
Build the
SessionFactory. |
LocalXSessionFactoryBuilder |
scanPackages(String... packagesToScan)
Perform Spring-based scanning for entity classes, registering them
as annotated classes with this
Configuration. |
LocalXSessionFactoryBuilder |
setJtaTransactionManager(Object jtaTransactionManager)
Set the Spring
JtaTransactionManager or the JTA TransactionManager
to be used with Hibernate, if any. |
addAnnotatedClass, addCacheableFile, addCacheableFile, addCacheableFileStrictly, addClass, addDirectory, addDocument, addFile, addFile, addInputStream, addJar, addPackage, addProperties, addResource, addResource, addURL, addXML, buildSessionFactory, configure, configure, configure, configure, configure, createQueryPlanCache, isPathPlanKeyVlidationSuspended, secondPassCompile, setCacheConcurrencyStrategy, setCacheConcurrencyStrategy, setCollectionCacheConcurrencyStrategy, setInterceptor, setNamingStrategy, setProperties, setPropertyadd, addAttributeConverter, addAttributeConverter, addAttributeConverter, addAttributeConverter, addAttributeConverter, addAuxiliaryDatabaseObject, addFetchProfile, addFilterDefinition, addSqlFunction, buildMapping, buildMappings, buildSettings, buildSettings, createMappings, doConfigure, doConfigure, findPossibleExtends, generateDropSchemaScript, generateSchemaCreationScript, generateSchemaUpdateScript, generateSchemaUpdateScriptList, getClassMapping, getClassMappings, getCollectionMapping, getCollectionMappings, getConfigurationInputStream, getCurrentTenantIdentifierResolver, getEntityNotFoundDelegate, getEntityResolver, getEntityTuplizerFactory, getFilterDefinitions, getIdentifierGeneratorFactory, getImports, getInterceptor, getJaccPermissionDeclarations, getMappedSuperclassMappings, getMappedSuperclassMappingsCopy, getNamedEntityGraphs, getNamedProcedureCallMap, getNamedQueries, getNamedSQLQueries, getNamingStrategy, getProperties, getProperty, getReflectionManager, getSessionFactoryObserver, getSqlFunctions, getSqlResultSetMappings, getTableMappings, getTypeResolver, iterateFetchProfiles, iterateGenerators, mergeProperties, registerTypeContributor, registerTypeOverride, registerTypeOverride, registerTypeOverride, reset, secondPassCompileForeignKeys, setCacheConcurrencyStrategy, setCollectionCacheConcurrencyStrategy, setCurrentTenantIdentifierResolver, setEntityNotFoundDelegate, setEntityResolver, setPrecedence, setSessionFactoryObserver, validateSchemapublic LocalXSessionFactoryBuilder(DataSource dataSource)
dataSource - the JDBC DataSource that the resulting Hibernate SessionFactory should be using
(may be null)public LocalXSessionFactoryBuilder(DataSource dataSource, ClassLoader classLoader)
dataSource - the JDBC DataSource that the resulting Hibernate SessionFactory should be using
(may be null)classLoader - the ClassLoader to load application classes frompublic LocalXSessionFactoryBuilder(DataSource dataSource, org.springframework.core.io.ResourceLoader resourceLoader)
dataSource - the JDBC DataSource that the resulting Hibernate SessionFactory should be using
(may be null)resourceLoader - the ResourceLoader to load application classes frompublic LocalXSessionFactoryBuilder setJtaTransactionManager(Object jtaTransactionManager)
JtaTransactionManager or the JTA TransactionManager
to be used with Hibernate, if any. Allows for using a Spring-managed transaction
manager for Hibernate 4's session and cache synchronization, with the
"hibernate.transaction.jta.platform" automatically set to it. Also sets
"hibernate.transaction.factory_class" to CMTTransactionFactory,
instructing Hibernate to interact with externally managed transactions.
A passed-in Spring JtaTransactionManager needs to contain a JTA
TransactionManager reference to be usable here, except for the WebSphere
case where we'll automatically set WebSphereExtendedJtaPlatform accordingly.
Note: If this is set, the Hibernate settings should not contain a JTA platform setting to avoid meaningless double configuration.
public LocalXSessionFactoryBuilder addAnnotatedClasses(Class<?>... annotatedClasses)
public LocalXSessionFactoryBuilder addPackages(String... annotatedPackages)
public LocalXSessionFactoryBuilder scanPackages(String... packagesToScan) throws org.hibernate.HibernateException
Configuration.packagesToScan - one or more Java package namesorg.hibernate.HibernateException - if scanning fails for any reasonpublic XSessionFactory buildSessionFactory() throws org.hibernate.HibernateException
SessionFactory.buildSessionFactory in class Configurationorg.hibernate.HibernateExceptionCopyright © 2015. All rights reserved.