All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.smallmind.persistence.schema-hibernate.xml Maven / Gradle / Ivy

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

  <import resource="classpath:org/smallmind/persistence/hibernate.xml"/>

  <!-- Liquibase updates -->
  <bean class="org.smallmind.liquibase.spring.SpringLiquibase">
    <property name="dataSource" ref="schemaPooledDataSource"/>
    <property name="source" value="CLASSPATH"/>
    <property name="goal" value="${liquibase.goal}"/>
    <property name="changeLogs">
      <list>
        <bean class="org.smallmind.liquibase.spring.ChangeLog">
          <property name="input" value="database/schema/schema.xml"/>
        </bean>
      </list>
    </property>
  </bean>

  <!-- Connection Pooling -->
  <bean id="schemaConnectionInstanceFactory" class="org.smallmind.persistence.sql.pool.DriverManagerComponentInstanceFactory">
    <constructor-arg index="0" value="${jdbc.driver.class_name.pool}"/>
    <constructor-arg index="1" value="${jdbc.url.pool}"/>
    <constructor-arg index="2" value="${jdbc.user.pool}"/>
    <constructor-arg index="3" value="${jdbc.password.pool}"/>
    <property name="validationQuery" value="${jdbc.validation_query.pool}"/>
  </bean>

  <bean id="schemaDBPool" class="org.smallmind.quorum.pool.complex.ComponentPool" init-method="startup" destroy-method="shutdown">
    <constructor-arg index="0" value="dbPool"/>
    <constructor-arg index="1" ref="schemaConnectionInstanceFactory"/>
    <property name="complexPoolConfig">
      <bean class="org.smallmind.quorum.pool.complex.ComplexPoolConfig">
        <property name="testOnAcquire" value="${jdbc.pool.test_on_acquire.pool}"/>
        <property name="initialPoolSize" value="${jdbc.pool.initial_size.poo}"/>
        <property name="minPoolSize" value="${jdbc.pool.min_size.poo}"/>
        <property name="maxPoolSize" value="${jdbc.pool.max_size.poo}"/>
        <property name="acquireWaitTimeMillis" value="750"/>
        <property name="creationTimeoutMillis" value="300"/>
        <property name="maxIdleTimeSeconds" value="300"/>
        <property name="maxLeaseTimeSeconds" value="1800"/>
      </bean>
    </property>
  </bean>

  <bean id="schemaPooledDataSource" class="org.smallmind.persistence.sql.pool.PooledDataSource">
    <constructor-arg index="0" value="schema"/>
    <constructor-arg index="1" ref="schemaDBPool"/>
  </bean>

  <!-- Session and Transaction -->
  <bean id="schemaSessionFactory" class="org.smallmind.persistence.orm.spring.hibernate.EntitySeekingSessionFactoryBean">
    <property name="sessionSourceKey" value="schema"/>
    <property name="dataSource" ref="schemaPooledDataSource"/>
    <property name="mappingLocations">
      <bean class="org.smallmind.persistence.orm.spring.hibernate.FileSeekingFactoryBean">
        <property name="sessionSourceKey" value="schema"/>
      </bean>
    </property>
    <property name="hibernateProperties">
      <value>
        hibernate.dialect=${hibernate.dialect}
        hibernate.hbm2ddl.auto=${hibernate.hbm2ddl.auto}
        hibernate.bytecode.use_reflection_optimizer=true
        hibernate.id.new_generator_mappings=true
        hibernate.connection.isolation=${hibernate.connection.isolation}
        hibernate.connection.autocommit=${hibernate.connection.autocommit}
        hibernate.jdbc.use_scrollable_resultset=true
        hibernate.jdbc.use_streams_for_binary=false
        hibernate.jdbc.batch_size=${hibernate.jdbc.batch_size}
        hibernate.query.substitutions=true 1, false 0
        hibernate.show_sql=${hibernate.show_sql}
        hibernate.format_sql=${hibernate.format_sql}
        hibernate.use_sql_comments=false
        hibernate.generate_statistics=false
        hibernate.cache.use_second_level_cache=${hibernate.cache.use_second_level_cache}
        hibernate.cache.use_query_cache=false
        hibernate.cache.use_minimal_puts=true
        hibernate.cache.provider_class=org.terracotta.hibernate.TerracottaHibernateCacheProvider
        hibernate.search.default.directory_provider=org.hibernate.search.store.FSDirectoryProvider
        hibernate.search.default.indexBase=${lucene.dir}
        hibernate.search.default.batch.merge_factor=10
        hibernate.search.default.batch.max_buffered_docs=100
      </value>
    </property>
  </bean>

  <!--Proxy Session-->
  <bean id="schemaProxySession" class="org.smallmind.persistence.orm.hibernate.HibernateProxySession" init-method="register">
    <constructor-arg index="0" value="orm"/>
    <constructor-arg index="1" value="schema"/>
    <constructor-arg index="2" ref="schemaSessionFactory"/>
    <constructor-arg index="3" value="true"/>
    <constructor-arg index="4" value="true"/>
  </bean>

</beans>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy