<?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:jdbc="http://www.springframework.org/schema/jdbc"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
		http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.1.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd">	
	
	<context:component-scan base-package="com.javahonk.dao, com.javahonk.model" />
	
	<tx:annotation-driven transaction-manager="transactionManager" />
	
	<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="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
          <property name="dataSource" ref="dataSource" />
          <property name="packagesToScan">
          	   <list>
          	   		<value>com.javahonk.model</value>
          	   		<value>com.javahonk.dao</value>          	   		
          	   </list>
          </property>
          <property name="hibernateProperties">
               <props>
                     <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                     <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                     <prop key="hibernate.c3p0.max_size">${hibernate.c3p0.max_size}</prop>
                     <prop key="hibernate.c3p0.min_size">${hibernate.c3p0.min_size}</prop>
                     <prop key="hibernate.c3p0.timeout">${hibernate.c3p0.timeout}</prop>
                     <prop key="hibernate.c3p0.max_statements">${hibernate.c3p0.max_statements}</prop>
                </props>
          </property>
          <property name="mappingLocations" value="hibernate.queries.xml"></property>
   </bean>
   
   <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
     <property name="sessionFactory" ref="sessionFactory"/>
   </bean>
	
</beans>