<?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:flex="http://www.springframework.org/schema/flex"
       xsi:schemaLocation="
		http://www.springframework.org/schema/beans 
		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
		http://www.springframework.org/schema/flex 
		http://www.springframework.org/schema/flex/spring-flex-1.0.xsd 
		http://www.springframework.org/schema/security 
		http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">

	<!--<bean id="theDataSource"
		class="com.mchange.v2.c3p0.ComboPooledDataSource">
		<property name="driverClass">
			<value>com.mysql.jdbc.Driver</value>
		</property>
		<property name="jdbcUrl">
			<value>jdbc:mysql://localhost:3306/synergy</value>
		</property>
		<property name="acquireIncrement">
			<value>3</value>
		</property>
		<property name="idleConnectionTestPeriod">
			<value>14400</value>
		</property>
		<property name="maxIdleTime">
			<value>25200</value>
		</property>
		<property name="initialPoolSize">
			<value>3</value>
		</property>
		<property name="maxPoolSize">
			<value>15</value>
		</property>
		<property name="minPoolSize">
			<value>3</value>
		</property>
		<property name="maxStatements">
			<value>0</value>
		</property>
		<property name="preferredTestQuery">
			<value>select 1;</value>
		</property>
		<property name="user">
			<value>synergy</value>
		</property>
		<property name="password">
			<value>synergy</value>
		</property>
	</bean>-->


	<bean id="hibernateProperties"
		class="org.springframework.beans.factory.config.PropertiesFactoryBean">
		<property name="properties">
			<props>
				<prop key="hibernate.hbm2ddl.auto">update</prop>
				<prop key="hibernate.dialect">
					org.hibernate.dialect.H2Dialect
				</prop>
				<prop key="hibernate.current_session_context_class">
					thread
				</prop>
				<!--
					<prop key="hibernate.connection.release_mode">on_close</prop> 
					<prop key="hibernate.connection.release_mode">after_statement</prop>
				-->
				<prop key="show_sql">true</prop>
			</props>
		</property>
	</bean>
	
	 <!-- Simple Spring-managed DataSource for embedded h2 database (http://www.h2database.com). H2 is used instead of HSQLDB in this Test Drive
    	 because it has better support for retrieving autogenerated keys using the JDBC 3 approach which is used by Spring's JdbcTemplate.
    	 The "jdbc:h2:~/sprinflexdemodb/sprinflexdemodb" URL points to a springflexdemodb database in the springdemodb directory 
    	 under the user's directory (represented by ~). H2 creates the database automatically if it doesn't exists, in which case, the dbInit bean
    	 takes care of creating and populating the sample tables.  
	-->
    <bean id="theDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="org.h2.Driver" />
        <property name="url" value="jdbc:h2:~/synergy/synergy" />
    </bean>

	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource">
			<ref local="theDataSource" />
		</property>
		<property name="hibernateProperties">
			<ref bean="hibernateProperties" />
		</property>
		<property name="mappingResources">
			<list>
				<value>com/rmg/synergy/vo/Test.hbm.xml</value>
				<value>com/rmg/synergy/vo/TestItem.hbm.xml</value>
			</list>
		</property>
	</bean>

    <!--
    <bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor">
        <property name="sessionFactory">
            <ref bean="sessionFactory" />
        </property>
    </bean>
    -->

</beans>
