<?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/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">


	<context:property-placeholder location="classpath:app.properties"/>

	<context:component-scan base-package="com.mindink" />

  	<bean id="mindinkJdbcDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${mindink.jdbc.driverClassName}"/>
        <property name="url" value="${mindink.jdbc.url}"/>
        <property name="username" value="${mindink.jdbc.username}"/>
        <property name="password" value="${mindink.jdbc.password}"/>
        <property name="defaultAutoCommit" value="false"/>
        <property name="testWhileIdle" value="true"/>
        <property name="timeBetweenEvictionRunsMillis" value="20000"/>
        <property name="numTestsPerEvictionRun" value="5"/>
        <property name="validationQuery" value="select 1"/>
        <property name="minIdle" value="${db.connection_pool.min_idle}"/>
        <property name="maxActive" value="${db.connection_pool.max_active}"/>
        <property name="minEvictableIdleTimeMillis" value="600000"/>
    </bean>



    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="mindinkJdbcDataSource" />
        <property name="packagesToScan" value="com.mindink" />
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${mindink.hibernate.dialect}</prop>
                <prop key="hibernate.default_schema">${mindink.db.schema_name}</prop>
                <prop key="hibernate.show_sql">false</prop>
                <!-- <prop key="hibernate.current_session_context_class">managed</prop>  -->
            </props>
        </property>
    </bean>
	
	<bean id="txManager"  class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>

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