<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
	<bean id="config" class="com.jxc.main.Config">
		<property name="map">
			<map>
			</map>
		</property>
	</bean>

	
	<bean id="dataSource"
		class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName">
			<value>org.apache.derby.jdbc.EmbeddedDriver</value>
		</property>
		<property name="url">
			<value>jdbc:derby:jxc;create=false</value>
		</property>

		<property name="username">
			<value>jxc</value>
		</property>
		<property name="password">
			<value>jxc</value>
		</property>
	</bean>	
	
	<!-- 
	<bean id="dataSource"
		class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName">
			<value>org.apache.derby.jdbc.ClientDriver</value>
		</property>
		<property name="url">
			<value>jdbc:derby://localhost:1527/jxc;create=false</value>
		</property>

		<property name="username">
			<value>jxc</value>
		</property>
		<property name="password">
			<value>jxc</value>
		</property>
	</bean>
	-->

	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="mappingResources">
			<list>
				<value>/com/jxc/domain/hbm/Userx.hbm.xml</value>
				<value>/com/jxc/domain/hbm/Rootpassword.hbm.xml</value>
				<value>/com/jxc/domain/hbm/UserFunction.hbm.xml</value>
				<value>/com/jxc/domain/hbm/Menu.hbm.xml</value>
				<value>/com/jxc/domain/hbm/Functionx.hbm.xml</value>
				<value>/com/jxc/domain/hbm/Customer.hbm.xml</value>
				<value>/com/jxc/domain/hbm/DataItem.hbm.xml</value>
				<value>/com/jxc/domain/hbm/Employ.hbm.xml</value>
				<value>/com/jxc/domain/hbm/EmployFee.hbm.xml</value>
				<value>/com/jxc/domain/hbm/Freight.hbm.xml</value>
				<value>/com/jxc/domain/hbm/Invest.hbm.xml</value>
				<value>/com/jxc/domain/hbm/OtherFee.hbm.xml</value>
				<value>/com/jxc/domain/hbm/ProductType.hbm.xml</value>
				<value>/com/jxc/domain/hbm/Product.hbm.xml</value>
				<value>/com/jxc/domain/hbm/Supplier.hbm.xml</value>
				<value>/com/jxc/domain/hbm/DataItemType.hbm.xml</value>
				<value>/com/jxc/domain/hbm/InnerDefine.hbm.xml</value>				
				<value>/com/jxc/domain/hbm/Purchase.hbm.xml</value>
				<value>/com/jxc/domain/hbm/PurchasePayDetail.hbm.xml</value>
				<value>/com/jxc/domain/hbm/PurchaseProductDetail.hbm.xml</value>
				<value>/com/jxc/domain/hbm/Sale.hbm.xml</value>
				<value>/com/jxc/domain/hbm/SaleProductDetail.hbm.xml</value>
				<value>/com/jxc/domain/hbm/SaleReceiveDetail.hbm.xml</value>
				<value>/com/jxc/domain/hbm/SaleServiceDetail.hbm.xml</value>
				<value>/com/jxc/domain/hbm/Seq.hbm.xml</value>
				<value>/com/jxc/domain/hbm/PurchaseReturn.hbm.xml</value>
				<value>/com/jxc/domain/hbm/PurchaseReturnProductDetail.hbm.xml</value>
				<value>/com/jxc/domain/hbm/PurchaseReturnReceiveDetail.hbm.xml</value>
				<value>/com/jxc/domain/hbm/SaleReturn.hbm.xml</value>
				<value>/com/jxc/domain/hbm/SaleReturnPayDetail.hbm.xml</value>
				<value>/com/jxc/domain/hbm/SaleReturnProductDetail.hbm.xml</value>
				<value>/com/jxc/domain/hbm/SaleReturnServiceDetail.hbm.xml</value>
				<value>/com/jxc/domain/hbm/ProductChangeHistory.hbm.xml</value>
				<value>/com/jxc/domain/hbm/Md5.hbm.xml</value>
				<value>/com/jxc/domain/hbm/InvalidProduct.hbm.xml</value>
				<value>/com/jxc/domain/hbm/PrepareReturnProduct.hbm.xml</value>
			</list>
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">
					org.hibernate.dialect.DerbyDialect
				</prop>
				<prop key="hibernate.format_sql">true</prop>
				<prop key="hibernate.use_sql_comments">false</prop>
				<prop key="hibernate.show_sql">true</prop>
			</props>
		</property>		
		
	</bean>	
	
	<!--  mysql
	<bean id="dataSource"
		class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName">
			<value>com.mysql.jdbc.Driver</value>
		</property>
		<property name="url">
			<value>jdbc:mysql://localhost:3306/jxc?useUnicode=true&amp;characterEncoding=UTF-8</value>
		</property>

		<property name="username">
			<value>root</value>
		</property>
		<property name="password">
			<value>root</value>
		</property>
	</bean>


	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="mappingResources">
			<list>
			</list>
		</property>

		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">
					org.hibernate.dialect.MySQLDialect
				</prop>
				<prop key="connection.useUnicode">true</prop>
				<prop key="connection.characterEncoding">UTF-8</prop>
				<prop key="hibernate.format_sql">true</prop>
				<prop key="hibernate.use_sql_comments">true</prop>
				<prop key="hibernate.show_sql">true</prop>
			</props>
		</property>
	</bean>

	-->





	<bean id="transactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>

	<bean id="transactionTemplate"
		class="org.springframework.transaction.support.TransactionTemplate">
		<property name="transactionManager">
			<ref local="transactionManager" />
		</property>
	</bean>

	<bean id="ui" class="com.jxc.ui.main.UiImpl" lazy-init="true"></bean>


	<bean id="adminServiceImpl"
		class="com.jxc.service.AdminServiceImpl">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>

	<bean id="adminService"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager" ref="transactionManager" />
		<property name="target" ref="adminServiceImpl" />
		<property name="transactionAttributes">
			<props>
				<prop key="*">PROPAGATION_REQUIRED</prop>
			</props>
		</property>
	</bean>


	<bean id="coreServiceImpl"
		class="com.jxc.service.CoreServiceImpl">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>

	<bean id="coreService"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager" ref="transactionManager" />
		<property name="target" ref="coreServiceImpl" />
		<property name="transactionAttributes">
			<props>
				<prop key="*">PROPAGATION_REQUIRED</prop>
			</props>
		</property>
	</bean>
	
	
	<bean id="queryServiceImpl"
		class="com.jxc.service.QueryServiceImpl">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>

	<bean id="queryService"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager" ref="transactionManager" />
		<property name="target" ref="queryServiceImpl" />
		<property name="transactionAttributes">
			<props>
				<prop key="*">PROPAGATION_REQUIRED</prop>
			</props>
		</property>
	</bean>

	<bean id="moneyServiceImpl"
		class="com.jxc.service.MoneyServiceImpl">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>

	<bean id="moneyService"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager" ref="transactionManager" />
		<property name="target" ref="moneyServiceImpl" />
		<property name="transactionAttributes">
			<props>
				<prop key="*">PROPAGATION_REQUIRED</prop>
			</props>
		</property>
	</bean>

	<bean id="testServiceImpl" class="com.jxc.service.TestServiceImpl">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>

	<bean id="testService"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager" ref="transactionManager" />
		<property name="target" ref="testServiceImpl" />
		<property name="transactionAttributes">
			<props>
				<prop key="*">PROPAGATION_REQUIRED</prop>
			</props>
		</property>
	</bean>

	<bean id="otherServiceImpl"
		class="com.jxc.service.OtherServiceImpl">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>

	<bean id="otherService"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager" ref="transactionManager" />
		<property name="target" ref="otherServiceImpl" />
		<property name="transactionAttributes">
			<props>
				<prop key="*">PROPAGATION_REQUIRED</prop>
			</props>
		</property>
	</bean>
	
	
	<!--                 derby                           -->
	<!-- 
	<bean id="derbyDataSource"
		class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName">
			<value>org.apache.derby.jdbc.ClientDriver</value>
		</property>
		<property name="url">
			<value>jdbc:derby://localhost:1527/jxc;create=false</value>
		</property>

		<property name="username">
			<value>jxc</value>
		</property>
		<property name="password">
			<value>jxc</value>
		</property>
	</bean>
	

	<bean id="derbySessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource" ref="derbyDataSource" />
		<property name="mappingResources">
			<list>
				<value>/com/jxc/domain/derby/Test.hbm.xml</value>
				<value>/com/jxc/domain/admin/Userx.hbm.xml</value>
				<value>/com/jxc/domain/admin/Rootpassword.hbm.xml</value>
				<value>/com/jxc/domain/admin/Secu.hbm.xml</value>
				<value>/com/jxc/domain/admin/UserFunction.hbm.xml</value>
				<value>/com/jxc/domain/admin/Menu.hbm.xml</value>
				<value>/com/jxc/domain/admin/Functionx.hbm.xml</value>
				<value>/com/jxc/domain/other/Customer.hbm.xml</value>
				<value>/com/jxc/domain/other/DataItem.hbm.xml</value>
				<value>/com/jxc/domain/other/Employ.hbm.xml</value>
				<value>/com/jxc/domain/other/EmployFee.hbm.xml</value>
				<value>/com/jxc/domain/other/Freight.hbm.xml</value>
				<value>/com/jxc/domain/other/Invest.hbm.xml</value>
				<value>/com/jxc/domain/other/OtherFee.hbm.xml</value>
				<value>/com/jxc/domain/other/ProductCategroy.hbm.xml</value>
				<value>/com/jxc/domain/other/Product.hbm.xml</value>
				<value>/com/jxc/domain/other/Supplier.hbm.xml</value>
				<value>/com/jxc/domain/other/DataItemType.hbm.xml</value>
				<value>/com/jxc/domain/other/InnerDefine.hbm.xml</value>				
			</list>
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">
					org.hibernate.dialect.DerbyDialect
				</prop>
				<prop key="hibernate.format_sql">true</prop>
				<prop key="hibernate.use_sql_comments">false</prop>
				<prop key="hibernate.show_sql">true</prop>
			</props>
		</property>		
		
	</bean>
	
	
	<bean id="derbyTransactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="derbySessionFactory" />
	</bean>

	<bean id="derbyTransactionTemplate"
		class="org.springframework.transaction.support.TransactionTemplate">
		<property name="transactionManager">
			<ref local="derbyTransactionManager" />
		</property>
	</bean>	
	
	<bean id="testServiceImpl" class="com.jxc.service.TestServiceImpl">
		<property name="sessionFactory" ref="derbySessionFactory" />
	</bean>

	<bean id="testService"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager" ref="derbyTransactionManager" />
		<property name="target" ref="testServiceImpl" />
		<property name="transactionAttributes">
			<props>
				<prop key="*">PROPAGATION_REQUIRED</prop>
			</props>
		</property>
	</bean>
	
	-->
</beans>
