浏览 1910 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2010-01-18
最后修改:2010-01-26
<!-- 第一步:配置数据源 --> <bean id="dateSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="java:comp/env/jdbc/oracle"> </property> </bean> <!-- 第二步:配置sessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dateSource" ref="dateSource"> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.Oracle9Dialect </prop> </props> </property> <property name="mappingResources"> <list> <value>com/gmd/pojo/TUser.hbm.xml</value> </list> </property> <!-- 第三步:配置事务管理器 --> <bean name="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"> </property> </bean> <!-- 第四步:配置事务父工厂 --> <bean name="baseTransactionProxyFactory" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true"> <property name="transactionManager" ref="transactionManager"> </property> <property name="transactionAttributes"> <props> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- 第五步:配置持久层对象 --> <bean name="userDao" class="com.gmd.dao.impl.UserDao"> <property name="sessionFactory" ref="sessionFactory"> </property> </bean> <!-- 第六步:配置服务层对象 --> <bean name="rbacService" class="com.gmd.service.impl.RBACService"> <property name="userdao" ref="userDao"> </property> </bean> <!-- 第七步:配置事务代理子工厂 --> <bean name="rbacServiceProxy" parent="baseTransactionProxyFactory"> <property name="target" ref="rbacService"> </property> </bean> <!-- 第八步:配置action对象 --> <bean name="/user" class="com.gmd.web.UserAction"> <property name="rbacService" ref="rbacServiceProxy"> </property> </bean> 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |