Package org.hibernate.testing.orm.junit
Class BaseSessionFactoryFunctionalTest
java.lang.Object
org.hibernate.testing.orm.junit.BaseSessionFactoryFunctionalTest
- All Implemented Interfaces:
DomainModelProducer
,DomainModelScopeAware
,ServiceRegistryProducer
,ServiceRegistryScopeAware
,SessionFactoryProducer
,SessionFactoryScopeAware
public abstract class BaseSessionFactoryFunctionalTest
extends Object
implements ServiceRegistryProducer, ServiceRegistryScopeAware, DomainModelProducer, DomainModelScopeAware, SessionFactoryProducer, SessionFactoryScopeAware
Template (GoF pattern) based abstract class for tests bridging the legacy
approach of SessionFactory building as a test fixture
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
protected final void
applyCacheSettings
(Metadata metadata) protected void
applyMetadataBuilder
(MetadataBuilder metadataBuilder) protected void
applyMetadataSources
(MetadataSources metadataSources) protected void
protected void
protected void
configure
(SessionFactoryBuilder builder) static void
doInHibernateSessionBuilder
(Supplier<SessionBuilder> sessionBuilderSupplier, TransactionUtil.HibernateTransactionConsumer function) Execute function in a Hibernate transaction without return valueprotected Future<?>
executeAsync
(Runnable callable) protected void
executeSync
(Runnable callable) protected boolean
protected <T> T
fromSession
(Function<SessionImplementor, T> action) protected <T> T
fromTransaction
(Function<SessionImplementor, T> action) protected Class[]
protected String
protected Dialect
protected MetadataImplementor
protected String[]
void
injectServiceRegistryScope
(ServiceRegistryScope registryScope) void
Callback to inject the SessionFactoryScope into the containervoid
injectTestModelScope
(DomainModelScope modelScope) protected void
inSession
(Consumer<SessionImplementor> action) protected void
inTransaction
(Consumer<SessionImplementor> action) protected boolean
protected boolean
void
produceModel
(StandardServiceRegistry serviceRegistry) produceServiceRegistry
(StandardServiceRegistryBuilder ssrBuilder) protected SessionFactoryImplementor
protected void
protected SessionFactoryScope
-
Field Details
-
DIALECT
-
NO_CLASSES
-
NO_MAPPINGS
-
-
Constructor Details
-
BaseSessionFactoryFunctionalTest
public BaseSessionFactoryFunctionalTest()
-
-
Method Details
-
sessionFactoryScope
-
sessionFactory
-
getMetadata
-
produceServiceRegistry
- Specified by:
produceServiceRegistry
in interfaceServiceRegistryProducer
-
prepareBootstrapRegistryBuilder
- Specified by:
prepareBootstrapRegistryBuilder
in interfaceServiceRegistryProducer
-
exportSchema
protected boolean exportSchema() -
applySettings
-
injectServiceRegistryScope
- Specified by:
injectServiceRegistryScope
in interfaceServiceRegistryScopeAware
-
produceModel
- Specified by:
produceModel
in interfaceDomainModelProducer
-
applyCacheSettings
-
overrideCacheStrategy
protected boolean overrideCacheStrategy() -
getCacheConcurrencyStrategy
-
applyMetadataBuilder
-
applyMetadataSources
-
getAnnotatedClasses
-
getOrmXmlFiles
-
injectTestModelScope
- Specified by:
injectTestModelScope
in interfaceDomainModelScopeAware
-
produceSessionFactory
- Specified by:
produceSessionFactory
in interfaceSessionFactoryProducer
-
configure
-
sessionFactoryBuilt
-
injectSessionFactoryScope
Description copied from interface:SessionFactoryScopeAware
Callback to inject the SessionFactoryScope into the container- Specified by:
injectSessionFactoryScope
in interfaceSessionFactoryScopeAware
-
afterTest
@AfterEach public final void afterTest() -
isCleanupTestDataRequired
protected boolean isCleanupTestDataRequired() -
cleanupTestData
protected void cleanupTestData() -
inTransaction
-
fromTransaction
-
inSession
-
fromSession
-
getDialect
-
executeAsync
-
executeSync
-
doInHibernateSessionBuilder
public static void doInHibernateSessionBuilder(Supplier<SessionBuilder> sessionBuilderSupplier, TransactionUtil.HibernateTransactionConsumer function) Execute function in a Hibernate transaction without return value- Parameters:
sessionBuilderSupplier
- SessionFactory supplierfunction
- function
-