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

esthub-jpa.2.2.0.source-code.resthubContext.xml Maven / Gradle / Ivy

<beans profile="resthub-jpa" xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx.xsd">

    <import resource="hikariCPContext.xml"/>
    <import resource="boneCPContext.xml"/>

    <context:annotation-config />
    <context:component-scan base-package="org.resthub.jpa" />

    <context:property-placeholder location="classpath*:persistence.properties" properties-ref="databaseProperties"
        ignore-resource-not-found="true" ignore-unresolvable="true" />

    <util:properties id="databaseProperties">
        <!-- JPA & Hibernate Resthub specific defaults -->
        <prop key="hibernate.show_sql">false</prop>
        <prop key="hibernate.dialect">org.hibernate.dialect.H2Dialect</prop>
        <prop key="hibernate.format_sql">true</prop>
        <prop key="hibernate.hbm2ddl.auto">update</prop>
        <prop key="hibernate.cache.use_second_level_cache">true</prop>
        <prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</prop>
        <prop key="hibernate.id.new_generator_mappings">true</prop>

        <prop key="persistenceUnit.packagesToScan"></prop>
    </util:properties>

    <bean id="dataSourceProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="location" value="classpath:datasource.properties"/>
        <property name="ignoreResourceNotFound" value="true" />
        <property name="properties" ref="defaultDataSourceProperties"/>
    </bean>

    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="packagesToScan" value="${persistenceUnit.packagesToScan}" />
        <property name="jpaVendorAdapter">
            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                <property name="showSql" value="${hibernate.show_sql}" />
            </bean>
        </property>
        <property name="jpaDialect">
            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
        </property>
        <property name="jpaProperties" ref="jpaProperties" />
        <property name="persistenceProvider">
            <bean class="org.hibernate.jpa.HibernatePersistenceProvider"/>
        </property>
    </bean>

    <util:map id="resthubCoreJpaProperties">
        <entry key="hibernate.dialect" value="${hibernate.dialect}" />
        <entry key="hibernate.format_sql" value="${hibernate.format_sql}" />
        <entry key="hibernate.hbm2ddl.auto" value="${hibernate.hbm2ddl.auto}" />
        <entry key="hibernate.cache.use_second_level_cache" value="${hibernate.cache.use_second_level_cache}" />
        <entry key="hibernate.cache.provider_class" value="${hibernate.cache.provider_class}" />
        <entry key="hibernate.id.new_generator_mappings" value="${hibernate.id.new_generator_mappings}" />
    </util:map>

    <bean id="jpaProperties" parent="resthubCoreJpaProperties">
        <property name="sourceMap">
            <map merge="true" />
        </property>
    </bean>

    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>

    <tx:annotation-driven />

</beans>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy