hibernate(applicationContext.xml)
来源:互联网 发布:小球发射java源代码 编辑:程序博客网 时间:2024/05/17 21:59
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.microsoft.jdbc.sqlserver.SQLServerDriver">
</property>
<property name="url"
value="jdbc:microsoft:sqlserver://localhost:1433;databaseName=pubs;selectMethod=cursor">
</property>
<property name="username" value="sa"></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.SQLServerDialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>hibernate/Users.hbm.xml</value>
</list>
</property>
</bean>
<bean id="userDao" class="dao.impl.HibernateUsersDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!--
事务装备,做真正的事务处理
-->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="realFacade" class="facade.Facade">
<property name="userDao" ref="userDao"></property>
</bean>
<!-- 配置抽象的aop-->
<bean id="abstractProxy" abstract="true"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager" />
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="login*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<!-- 配置具体的代理-->
<bean id="facade" parent="abstractProxy">
<property name="target" ref="realFacade"></property>
</bean>
<bean name="/login" class="struts.action.LoginAction">
<property name="facade" ref="facade"></property>
</bean>
<bean name="/update" class="struts.action.UpdateAction">
<property name="facade" ref="facade"></property>
</bean>
<bean name="/delete" class="struts.action.DeleteAction">
<property name="facade" ref="facade"></property>
</bean>
<bean name="/insert" class="struts.action.InsertAction">
<property name="facade" ref="facade"></property>
</bean>
<bean name="/getByUserName"
class="struts.action.GetByUserNameAction">
<property name="facade" ref="facade"></property>
</bean>
<bean name="/getAll" class="struts.action.GetAllAction">
<property name="facade" ref="facade"></property>
</bean>
<bean name="/getPage" class="struts.action.GetPageAction">
<property name="facade" ref="facade"></property>
</bean>
</beans>
在struts-config.xml中的:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans >
<form-bean name="usersForm" type="struts.form.UsersForm" />
</form-beans>
<global-exceptions />
<global-forwards >
<forward name="success" path="/success.jsp" />
<forward name="error" path="/error.jsp" />
</global-forwards>
<action-mappings >
<action
attribute="usersForm"
name="usersForm"
path="/insert"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy" />
<action
attribute="usersForm"
name="usersForm"
path="/update"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy" />
<action
attribute="usersForm"
name="usersForm"
path="/delete"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy" />
<action
attribute="usersForm"
name="usersForm"
path="/getByUserName"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy" >
<forward name="success" path="/update.jsp" />
</action>
<action
path="/login"
type="org.springframework.web.struts.DelegatingActionProxy" >
<forward name="success" path="/index.jsp" />
</action>
<action
path="/getAll"
type="org.springframework.web.struts.DelegatingActionProxy" >
<forward name="success" path="/getPage.do" />
</action>
<action
path="/getPage"
type="org.springframework.web.struts.DelegatingActionProxy" >
<forward name="success" path="/userList.jsp" />
</action>
</action-mappings>
<message-resources parameter="struts.ApplicationResources" />
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
</plug-in>
</struts-config>
- hibernate applicationContext-db.xml
- hibernate(applicationContext.xml)
- applicationContext.xml整合hibernate mybatis
- spring+hibernate 配置文件(applicationContext.xml)实例
- spring+hibernate之applicationContext.xml配置
- spring+hibernate中applicationContext.xml详解
- spring+hibernate之applicationContext.xml配置
- spring+hibernate中applicationContext.xml详解
- spring+hibernate中applicationContext.xml详解
- spring+hibernate applicationContext.xml配置文件写法
- spring+hibernate中applicationContext.xml详解
- Hibernate与Spring整合,配置文件applicationContext.xml
- Hibernate与Spring整合,配置文件applicationContext.xml
- Spring+Hibernate配置文件-applicationContext.xml设置
- hibernate关于applicationContext.xml映射配置
- spring、hibernate整合核心配置文件applicationContext.xml
- SSH整合配置applicationContext.xml/hibernate.cfg.xml/struts.xml
- jsf、Spring、Hibernate 集成 applicationContext-hibernate.xml 配置
- T型人格 type T personality
- My bad! 对不起
- Java:Unicode简介
- [双语阅读]米歇尔白宫大转呼啦圈 宣传儿童健康
- Little-Endian(小字节序)、BIG-ENDIAN(大字节序)、主机序、网络序
- hibernate(applicationContext.xml)
- learn the ubuntu or configure the ubuntu
- 屏蔽右键
- Oracle Merge Into 的用法详解实例
- 第一次
- 传说中的网易测试题目
- 常用正则表达式密码验证实例
- php 三种跳转方法
- ibaties(applicationContext.xml)