<?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="DataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName">
			<value>com.mysql.jdbc.Driver</value>
		</property>
		<property name="url">
			<value>jdbc:mysql://localhost:3306/gbook?useUnicode=true&amp;characterEncoding=UTF-8</value>
		</property>
		<property name="username">
			<value>root</value>
		</property>
		<property name="password">
			<value>password</value>
		</property>
	</bean>
	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource">
			<ref bean="DataSource" />
		</property>
		<property name="hibernateProperties">
			<props><prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
			<prop key="hibernate.show_sql">true</prop>
			</props>
		</property>
		<property name="mappingResources">
			<list>
				<value>cn/jack/hibernate/Bookcontent.hbm.xml</value>
				<value>cn/jack/hibernate/Manager.hbm.xml</value></list>
		</property></bean>
<!-- transactionManager -->
		<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory">
			<ref local="sessionFactory" />
		</property>
	</bean>
<!-- 留言程序设置 -->	
		<bean id="bdao" class="cn.jack.service.BookcontentDaoImp">
		<property name="sessionFactory">
			<ref local="sessionFactory" />
		</property>
	</bean>
		<bean id="bdaoProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager">
			<ref bean="transactionManager" />
		</property>
		<property name="target">
			<ref local="bdao" />
		</property>
		<property name="transactionAttributes">
			<props>
				<prop key="insert*">PROPAGATION_REQUIRED</prop>
				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
				<prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
			</props>
		</property>
	</bean>
	<bean name="/gbook" class="cn.jack.struts.GbookAction" singleton="false">
		<property name="bdao">
			<ref bean="bdaoProxy" />
		</property>
	</bean>
<!-- 用户登录程序 -->
     <bean id="ldao" class="cn.jack.service.LoginsDaoImp">
     <property name="sessionFactory"><ref local="sessionFactory" /></property>
     </bean>
     
     <bean id="loginProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
     <property name="transactionManager"><ref bean="transactionManager"/></property>
     <property name="target"><ref local="ldao"/></property>
     <property name="transactionAttributes">
			<props>
				<prop key="insert*">PROPAGATION_REQUIRED</prop>
				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
				<prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
			</props>
	
     </property>
     </bean>
     
     <bean name="/logins" class="cn.jack.struts.LoginsAction" singleton="false">
     <property name="ldao"><ref bean="loginProxy"/></property>
     </bean>
<!-- 搜索 -->
     <bean id="sdao" class="cn.jack.service.SearchDaoImp">
     <property name="sessionFactory"><ref local="sessionFactory"/></property>
     </bean>
     
     <bean id="searchProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
     <property name="transactionManager"><ref bean="transactionManager"/></property>
     <property name="target"><ref local="sdao"/></property>
     <property name="transactionAttributes">
     <props>
				<prop key="insert*">PROPAGATION_REQUIRED</prop>
				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
				<prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
			</props>
     </property>
     </bean>
     <bean name="/search" class="cn.jack.struts.SearchAction">
     <property name="sdao"><ref bean="searchProxy"/></property>
     </bean>
     
	</beans>