<?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" xmlns:p="http://www.springframework.org/schema/p"
	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.xsd">


  <context:component-scan base-package="gov.va.med.mpn.dao"/>
    <context:component-scan base-package="gov.va.med.mpn.entity"/>

	 <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="false"/>



	  <!-- Definition for JNDI based DataSource Spring bean representing the DB connection used by Hibernate -->
	  <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
		<property name="jndiTemplate"><ref bean="jndiTemplate"/></property>
		<property name="jndiName"><value>java:comp/env/jdbc/smartforms</value></property>
		<property name="resourceRef"><value>true</value></property>
		<property name="expectedType"><value>javax.sql.DataSource</value></property>
	  </bean>

	   <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate"/>


	<bean id="entityManagerFactory"
		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
		<property name="persistenceUnitName" value="mpnPU" />
		<property name="dataSource" ref="dataSource" />
	</bean>

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

</beans>