<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

	<!-- use: ReflectiveLoadTimeWeaver for Tomcat etc -->
	<context:load-time-weaver
		weaver-class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />


	<!-- JPA EntityManagerFactory -->
	<bean id="entityManagerFactory"
		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
		<property name="dataSource" ref="dataSource" />

		<!-- jpaVendorAdapter Hibernate, injected into emf -->
		<property name="jpaVendorAdapter">
			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
				<property name="database" value="HSQL" />
				<property name="showSql" value="false" />

				<!--
					Data Definition Language script is generated and executed for each
					run
				-->
				<property name="generateDdl" value="true" />
			</bean>
		</property>

		<!-- loadTimeWeaver -->
		<property name="loadTimeWeaver">
			<bean
				class="org.springframework.instrument.classloading.SimpleLoadTimeWeaver" />
		</property>
	</bean>

	<!--
		datasource in memory HSQLDB -- <bean id="dataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
		<property name="url" value="jdbc:hsqldb:mem:myspring"/> <property
		name="username" value="sa"/> <property name="password" value=""/>
		</bean>
	-->
	<!--
		Configurer that replaces ${...} placeholders with values from a
		properties file
	-->
	<!--
		(in this case, JDBC-related settings for the dataSource definition
		below)
	-->
	<bean id="propertyConfigurer"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location" value="/WEB-INF/jdbc.properties" />
	</bean>

	<bean id="dataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="${jdbc.driverClassName}" />
		<property name="url" value="${jdbc.url}" />
		<property name="username" value="${jdbc.username}" />
		<property name="password" value="${jdbc.password}" />
	</bean>


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

	<bean id="customerDAO" class="com.abcseo.JPACustomerDAO">
		<property name="entityManagerFactory" ref="entityManagerFactory" />
	</bean>

</beans>