Class BaseSessionFactoryFunctionalTest

java.lang.Object
org.hibernate.testing.orm.junit.BaseSessionFactoryFunctionalTest
All Implemented Interfaces:
DomainModelProducer, DomainModelScopeAware, ServiceRegistryProducer, ServiceRegistryScopeAware, SessionFactoryProducer, SessionFactoryScopeAware

Template (GoF pattern) based abstract class for tests bridging the legacy approach of SessionFactory building as a test fixture
  • Field Details

    • DIALECT

      protected static final org.hibernate.dialect.Dialect DIALECT
    • NO_CLASSES

      protected static final Class[] NO_CLASSES
    • NO_MAPPINGS

      protected static final String[] NO_MAPPINGS
  • Constructor Details

    • BaseSessionFactoryFunctionalTest

      public BaseSessionFactoryFunctionalTest()
  • Method Details

    • sessionFactoryScope

      protected SessionFactoryScope sessionFactoryScope()
    • sessionFactory

      protected org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory()
    • getMetadata

      protected org.hibernate.boot.spi.MetadataImplementor getMetadata()
    • produceServiceRegistry

      public org.hibernate.boot.registry.StandardServiceRegistry produceServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistryBuilder ssrBuilder)
      Specified by:
      produceServiceRegistry in interface ServiceRegistryProducer
    • prepareBootstrapRegistryBuilder

      public void prepareBootstrapRegistryBuilder(org.hibernate.boot.registry.BootstrapServiceRegistryBuilder bsrb)
      Specified by:
      prepareBootstrapRegistryBuilder in interface ServiceRegistryProducer
    • exportSchema

      protected boolean exportSchema()
    • applySettings

      protected void applySettings(org.hibernate.boot.registry.StandardServiceRegistryBuilder builder)
    • injectServiceRegistryScope

      public void injectServiceRegistryScope(ServiceRegistryScope registryScope)
      Specified by:
      injectServiceRegistryScope in interface ServiceRegistryScopeAware
    • produceModel

      public org.hibernate.boot.spi.MetadataImplementor produceModel(org.hibernate.boot.registry.StandardServiceRegistry serviceRegistry)
      Specified by:
      produceModel in interface DomainModelProducer
    • applyCacheSettings

      protected final void applyCacheSettings(org.hibernate.boot.Metadata metadata)
    • overrideCacheStrategy

      protected boolean overrideCacheStrategy()
    • getCacheConcurrencyStrategy

      protected String getCacheConcurrencyStrategy()
    • applyMetadataBuilder

      protected void applyMetadataBuilder(org.hibernate.boot.MetadataBuilder metadataBuilder)
    • applyMetadataSources

      protected void applyMetadataSources(org.hibernate.boot.MetadataSources metadataSources)
    • getAnnotatedClasses

      protected Class[] getAnnotatedClasses()
    • getOrmXmlFiles

      protected String[] getOrmXmlFiles()
    • injectTestModelScope

      public void injectTestModelScope(DomainModelScope modelScope)
      Specified by:
      injectTestModelScope in interface DomainModelScopeAware
    • produceSessionFactory

      public org.hibernate.engine.spi.SessionFactoryImplementor produceSessionFactory(org.hibernate.boot.spi.MetadataImplementor model)
      Specified by:
      produceSessionFactory in interface SessionFactoryProducer
    • configure

      protected void configure(org.hibernate.boot.SessionFactoryBuilder builder)
    • sessionFactoryBuilt

      protected void sessionFactoryBuilt(org.hibernate.engine.spi.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 interface SessionFactoryScopeAware
    • afterTest

      @AfterEach public final void afterTest()
    • isCleanupTestDataRequired

      protected boolean isCleanupTestDataRequired()
    • cleanupTestData

      protected void cleanupTestData()
    • inTransaction

      protected void inTransaction(Consumer<org.hibernate.engine.spi.SessionImplementor> action)
    • fromTransaction

      protected <T> T fromTransaction(Function<org.hibernate.engine.spi.SessionImplementor,T> action)
    • inSession

      protected void inSession(Consumer<org.hibernate.engine.spi.SessionImplementor> action)
    • fromSession

      protected <T> T fromSession(Function<org.hibernate.engine.spi.SessionImplementor,T> action)
    • getDialect

      protected org.hibernate.dialect.Dialect getDialect()
    • executeAsync

      protected Future<?> executeAsync(Runnable callable)
    • executeSync

      protected void executeSync(Runnable callable)
    • doInHibernateSessionBuilder

      public static void doInHibernateSessionBuilder(Supplier<org.hibernate.SessionBuilder> sessionBuilderSupplier, TransactionUtil.HibernateTransactionConsumer function)
      Execute function in a Hibernate transaction without return value
      Parameters:
      sessionBuilderSupplier - SessionFactory supplier
      function - function