applicationContext-hibernate.xml 3.68 KB
<?xml version="1.0" encoding="UTF-8"?>
<beans 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: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/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

	<!-- INICIO envers -->
	<!-- <bean name="auditEventListener" class="org.hibernate.envers.event.AuditEventListener" /> -->
	<!-- FIM Envers -->

	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
		autowire-candidate="true" lazy-init="false">
		<property name="dataSource" ref="dataSource" />

		<!-- <property name="eventListeners">
			 <map>
				<entry key="post-insert">
					<list>
						<ref bean="auditEventListener" />
					</list>
				</entry>
				<entry key="post-update">
					<list>
						<ref bean="auditEventListener" />
					</list>
				</entry>
				<entry key="post-delete">
					<list>
						<ref bean="auditEventListener" />
					</list>
				</entry>
				<entry key="pre-collection-update">
					<ref bean="auditEventListener" />
				</entry>
				<entry key="pre-collection-remove">
					<ref bean="auditEventListener" />
				</entry>
				<entry key="post-collection-recreate">
					<ref bean="auditEventListener" />
				</entry>
			</map>
		</property> -->
		<!-- FIM envers -->

		<property name="hibernateProperties">
			<props>
			    <!-- 
				<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
				 -->
				 <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
				<prop key="hibernate.order_updates">true</prop>
				<prop key="hibernate.auto_commit">false</prop>
				<prop key="hibernate.show_sql">true</prop>
				<prop key="hibernate.format_sql">true</prop>
				<prop key="hibernate.archive.autodetection">class</prop>
				<prop key="hibernate.current_session_context_class">thread</prop>
				<!-- Usado para não abrir muitas conexões com o BD -->
				<prop key="hibernate.connection.release_mode">after_statement</prop>
				
				<!--


				<prop key="org.hibernate.envers.audit_table_prefix">LOG_</prop>
				<prop key="org.hibernate.envers.audit_table_suffix"></prop>
				<prop key="org.hibernate.envers.revision_type_field_name">NUM_OPERACAO</prop>
				<prop key="org.hibernate.envers.revision_field_name">ID_AUDITORIA</prop>
				<prop key="org.hibernate.envers.store_data_at_delete">true</prop>


				<prop key="org.hibernate.envers.default_schema">LOG</prop>
				<prop key="org.hibernate.envers.default_catalog">RPNBL</prop>


			-->
			</props>
		</property>

		<property name="annotatedClasses">
			<bean factory-bean="scannerClass" factory-method="getClasses" />
		</property>


	</bean>

	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="autodetectDataSource" value="true" />
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>

	<tx:annotation-driven transaction-manager="transactionManager" />

	<bean id="scannerClass" class="br.gov.arquitetura.util.AnnotatedEntityDetector">
		<property name="basePackage" value="br.gov.mc.corporativo.*,br.gov.mc.*" />
	    <!--  
		<property name="basePackage" value="br.gov.mc.cadsei,br.gov.arquitetura,br.gov.mc.cadsei.entidade,br.gov.mc.cadsei.service,br.gov.mc.cadsei.service.impl,br.gov.mc.arquitetura.persistencia.impl,br.gov.arquitetura.service.impl" />
		 -->
	</bean>

</beans>