<?xml version="1.0" encoding="UTF-8"?>
	<!--  Namespace type configuration  -->
<beans default-lazy-init="false"
	xmlns="http://www.springframework.org/schema/beans" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:jee="http://www.springframework.org/schema/jee"
	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-3.0.xsd
    	http://www.springframework.org/schema/jee 
    	http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">

	<!--  datasource is referenced in the persistence.xml -->
	<jee:jndi-lookup id="dataSource" jndi-name="${ccht.datasource}" />

	<!-- 
	<bean id="transactionManager"
		class="org.springframework.transaction.jta.WebLogicJtaTransactionManager">
		<property name="transactionManagerName" value="javax.transaction.TransactionManager" />
	</bean>
	-->
 	<tx:jta-transaction-manager/> 
 	
	<bean id="ihtaPersistenceUnitManager" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">  
    	 <property name="persistenceXmlLocations">    
    		<list>      
    			<value>classpath*:hibernate/ihtapersistence-jta.xml</value>    
    		</list>  
    	 </property>   	 
    </bean>
    
    <!--  Spring based configuration for Hibernate entity manager -->    
    <bean id="ihtaEntityManagerFactory"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">        
        <property name="jpaVendorAdapter">
            <bean
                class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                <property name="database" value="${hibernate.databaseType}" />
                <property name="showSql" value="${hibernate.show_sql}" />
            </bean>
        </property>
        <property name="persistenceUnitManager" ref="ihtaPersistenceUnitManager"></property>
          
 	    <property name="jpaPropertyMap">
 	       <map>
 	           <entry key="hibernate.transaction.manager_lookup_class"
 	               value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
 	           <entry key="hibernate.current_session_context_class" value="jta"/>
 	           <entry key="hibernate.connection.release_mode" value="auto"/>
 	           <entry key="hibernate.connection.isolation"  value="4096"/> 	            
 	           <entry key="hibernate.ejb.interceptor"  
 	           	value="gov.va.med.fw.persistent.hibernate.EntityInterceptor"/>
 	           <entry key="hibernate.max_fetch_depth" value="10" />
 	           <entry key="hibernate.format_sql" value="true" />
	           <entry key="hibernate.use_sql_comments" value="true" />
 	       </map>
 	   </property>
 	   
        <!-- specify that the Hibernate JPA dialect should be used, probably not necessary since 
          HibernateJpaVendorAdapter will most likely set this property -->
        <property name="jpaDialect">
            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>
        </property>
    </bean>
    
    <!--  Reports -->		
	<bean id="ihtaReportsPersistenceUnitManager" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">  
    	 <property name="persistenceXmlLocations">    
    		<list>      
    			<value>classpath*:hibernate/ihtareportspersistence-jta.xml</value>    
    		</list>  
    	 </property>   	 
    </bean>
        				    
    <!--  Spring based configuration for Hibernate entity manager -->    
    <bean id="ihtaReportsEntityManagerFactory"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">        
        <property name="jpaVendorAdapter">
            <bean
                class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                <property name="database" value="${hibernate.databaseType}" />
                <property name="showSql" value="${hibernate.show_sql}" />
            </bean>
        </property>
        <property name="persistenceUnitManager" ref="ihtaReportsPersistenceUnitManager"></property>
          
 	    <property name="jpaPropertyMap">
 	       <map>
 	           <entry key="hibernate.transaction.manager_lookup_class"
 	               value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
 	           <entry key="hibernate.current_session_context_class" value="jta"/>
 	           <entry key="hibernate.connection.release_mode" value="auto"/>
 	           <entry key="hibernate.connection.isolation"  value="4096"/>    
 	           <entry key="hibernate.ejb.interceptor"  
 	           	value="gov.va.med.fw.persistent.hibernate.EntityInterceptor"/>	 
 	           	<entry key="hibernate.max_fetch_depth" value="10" />                 	                                   
 	       </map>
 	   </property>
 	   
        <!-- specify that the Hibernate JPA dialect should be used, probably not necessary since 
          HibernateJpaVendorAdapter will most likely set this property -->
        <property name="jpaDialect">
            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>
        </property>
    </bean>    	

	<!-- THIS SECTION BELOW HERE IS DATABASE DIALECT SPECIFIC -->
	<bean id="hibernate.currentTimestampAction"
		class="gov.va.med.fw.persistent.hibernate.CurrentTimestampAction">
		<property name="dialectSpecificCurrentTimestampFunction"
			value="getDate()" />
	</bean>

</beans>
