META-INF.osnz.spring-hibernate.xml Maven / Gradle / Ivy
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <bean id="sqlService" class="nz.net.osnz.common.hibernate.SqlService"/> <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <!--<prop key="hibernate.current_session_context_class">--> <!--org.springframework.orm.hibernate5.SpringSessionContext--> <!--</prop>--> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> <prop key="cache.use_query_cache">${hibernate.cache.use_query_cache}</prop> <prop key="cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}</prop> <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop> </props> </property> <!-- Entity package --> <property name="packagesToScan" value="nz.net.osnz.**.domain"/> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <tx:annotation-driven transaction-manager="transactionManager" mode="proxy" proxy-target-class="true" /> </beans>