open class LocalSessionFactoryBuilder : Configuration
A Spring-provided extension of the standard Hibernate Configuration class, adding SpringSessionContext as a default and providing convenient ways to specify a DataSource and an application class loader.
This is designed for programmatic use, e.g. in @Bean factory methods. Consider using LocalSessionFactoryBean for XML bean definition files.
Compatible with Hibernate 5.0/5.1 as well as 5.2, as of Spring 4.3.
Author
Juergen Hoeller
Since
4.2
See Also
LocalSessionFactoryBean
LocalSessionFactoryBuilder(dataSource: DataSource)LocalSessionFactoryBuilder(dataSource: DataSource, classLoader: ClassLoader)LocalSessionFactoryBuilder(dataSource: DataSource, resourceLoader: ResourceLoader)LocalSessionFactoryBuilder(dataSource: DataSource, resourceLoader: ResourceLoader, metadataSources: MetadataSources)
Create a new LocalSessionFactoryBuilder for the given DataSource. |
open fun addAnnotatedClasses(vararg annotatedClasses: Class<*>): LocalSessionFactoryBuilder
Add the given annotated classes in a batch. |
|
open fun addPackages(vararg annotatedPackages: String): LocalSessionFactoryBuilder
Add the given annotated packages in a batch. |
|
open fun buildSessionFactory(bootstrapExecutor: AsyncTaskExecutor): SessionFactory
Build the Hibernate
|
|
open fun scanPackages(vararg packagesToScan: String): LocalSessionFactoryBuilder
Perform Spring-based scanning for entity classes, registering them as annotated classes with this |
|
open fun setCurrentTenantIdentifierResolver(currentTenantIdentifierResolver: CurrentTenantIdentifierResolver): Unit
Overridden to reliably pass a CurrentTenantIdentifierResolver to the SessionFactory. |
|
open fun setEntityTypeFilters(vararg entityTypeFilters: TypeFilter): LocalSessionFactoryBuilder
Specify custom type filters for Spring-based scanning for entity classes. Default is to search all specified packages for classes annotated with |
|
open fun setJtaTransactionManager(jtaTransactionManager: Any): LocalSessionFactoryBuilder
Set the Spring JtaTransactionManager or the JTA TransactionManager to be used with Hibernate, if any. Allows for using a Spring-managed transaction manager for Hibernate 5's session and cache synchronization, with the "hibernate.transaction.jta.platform" automatically set to it. 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 Note: If this is set, the Hibernate settings should not contain a JTA platform setting to avoid meaningless double configuration. |
|
open fun setMultiTenantConnectionProvider(multiTenantConnectionProvider: MultiTenantConnectionProvider): LocalSessionFactoryBuilder
Set a MultiTenantConnectionProvider to be passed on to the SessionFactory. |