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 Modifier and Type Field Description protected static Dialect
DIALECT
protected static Class[]
NO_CLASSES
protected static String[]
NO_MAPPINGS
-
Constructor Summary
Constructors Constructor Description BaseSessionFactoryFunctionalTest()
-
Method Summary
-
-
-
Method Detail
-
sessionFactoryScope
protected SessionFactoryScope sessionFactoryScope()
-
sessionFactory
protected SessionFactoryImplementor sessionFactory()
-
getMetadata
protected MetadataImplementor getMetadata()
-
produceServiceRegistry
public StandardServiceRegistry produceServiceRegistry(StandardServiceRegistryBuilder ssrBuilder)
- Specified by:
produceServiceRegistry
in interfaceServiceRegistryProducer
-
prepareBootstrapRegistryBuilder
public void prepareBootstrapRegistryBuilder(BootstrapServiceRegistryBuilder bsrb)
- Specified by:
prepareBootstrapRegistryBuilder
in interfaceServiceRegistryProducer
-
exportSchema
protected boolean exportSchema()
-
applySettings
protected void applySettings(StandardServiceRegistryBuilder builder)
-
injectServiceRegistryScope
public void injectServiceRegistryScope(ServiceRegistryScope registryScope)
- Specified by:
injectServiceRegistryScope
in interfaceServiceRegistryScopeAware
-
produceModel
public MetadataImplementor produceModel(StandardServiceRegistry serviceRegistry)
- Specified by:
produceModel
in interfaceDomainModelProducer
-
applyCacheSettings
protected final void applyCacheSettings(Metadata metadata)
-
overrideCacheStrategy
protected boolean overrideCacheStrategy()
-
getCacheConcurrencyStrategy
protected String getCacheConcurrencyStrategy()
-
applyMetadataBuilder
protected void applyMetadataBuilder(MetadataBuilder metadataBuilder)
-
applyMetadataSources
protected void applyMetadataSources(MetadataSources metadataSources)
-
getAnnotatedClasses
protected Class[] getAnnotatedClasses()
-
getOrmXmlFiles
protected String[] getOrmXmlFiles()
-
injectTestModelScope
public void injectTestModelScope(DomainModelScope modelScope)
- Specified by:
injectTestModelScope
in interfaceDomainModelScopeAware
-
produceSessionFactory
public SessionFactoryImplementor produceSessionFactory(MetadataImplementor model)
- Specified by:
produceSessionFactory
in interfaceSessionFactoryProducer
-
configure
protected void configure(SessionFactoryBuilder builder)
-
sessionFactoryBuilt
protected void sessionFactoryBuilt(SessionFactoryImplementor factory)
-
injectSessionFactoryScope
public void injectSessionFactoryScope(SessionFactoryScope scope)
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
protected void inTransaction(Consumer<SessionImplementor> action)
-
fromTransaction
protected <T> T fromTransaction(Function<SessionImplementor,T> action)
-
inSession
protected void inSession(Consumer<SessionImplementor> action)
-
fromSession
protected <T> T fromSession(Function<SessionImplementor,T> action)
-
getDialect
protected Dialect getDialect()
-
executeSync
protected void executeSync(Runnable callable)
-
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
-
-