首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > flex >

Flex+spring+hibernate调整视频学习交流part_2

2012-11-23 
Flex+spring+hibernate整合视频学习交流part_2------------文件下载说明flexssh.rar 是源文件,没有包,包要

Flex+spring+hibernate整合视频学习交流part_2

------------文件下载说明

flexssh.rar 是源文件,没有包,包要自己导入。在我讲解中已经导入了ssh1的包了.

为整合flex+struts/flex+ssh1 做准备了,

?

7>撰写相关类 COMMON,DAO,SERVICE (公共类、DAO类、SERVICE类)
??????? 1>类包说明 ??CommonBase 基类 com.lwxshow包含所有的类
??????? 2>GenerateException 是一个异常类,我这里没有作什么处理.
??????? 3>部门,员工 EmpDaoImpl,DepDaoImpl DAO类? EmpDao,IDepDao接口DAO
??????? 4>EmpServiceImpl,DepServiceImpl Service类 IEmpService,IDepService 接口Service
???? 8>在Spring 配置文件applicatonContext.xml中注册 类
???????? 1.替换原有的<beans xmlns="">
??????? <?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:util="http://www.springframework.org/schema/util"
?????????xmlns:p="http://www.springframework.org/schema/p"
?????????xmlns:aop="http://www.springframework.org/schema/aop"
?????????xmlns:tx="http://www.springframework.org/schema/tx"
?????????xsi:schemaLocation="
?????????????????http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
?????????????????http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
?????????????????http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
?????????????????http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
????????
?????????<!--regist in connect database-->
?????????<bean id="sessionFactory"
??????????abstract="true">
??????????<property name="sessionFactory" ref="sessionFactory"></property>
?????????</bean>
?????????
?????????<!-- config DaoImpl beans
?????????EmpDaoImpl
?????????DepDaoImpl
?????????parent:说明 继承自CommonBase
?????????-->
?????????<bean id="empDaoImpl" parent="commonbase"/>
?????????<bean id="depDaoImpl" parent="commonbase"/>
?????????
?????????<!-- config? ServicesImpl beans
?????????属性说明:一定要生成set方法,并且不能创建实例. 一般用接口去声明
?????????两个类中都有,我们都要一一注册 property name="名称" ref="上面定义的id
?????????-->
?????????<bean id="empServiceImpl" ref="empDaoImpl"></property>
??????????<property name="idepDao" ref="depDaoImpl"></property>
?????????</bean>
?????????<bean id="depServiceImpl" ref="empDaoImpl"></property>
??????????<property name="idepDao" ref="depDaoImpl"></property>
?????????</bean>
?????????<!-- create transactionManager -->
?????????<bean id="transactionManager" ref="sessionFactory"></property>
?????????</bean>
?????????<!-- use transactionManager -->
?????????<tx:advice id="mytran" transaction-manager="transactionManager">
??????????<tx:attributes>
???????????<tx:method name="add*" propagation="REQUIRED"/>
???????????<tx:method name="delete*" propagation="REQUIRED"/>
???????????<tx:method name="update*" propagation="REQUIRED"/>
???????????<tx:method name="*" read-only="true"/>
??????????</tx:attributes>
?????????</tx:advice>
?????????<!-- Spring aop config 也就是Service-->
?????????<aop:config>
??????????<aop:advisor advice-ref="mytran" pointcut="execution (* com.lwxshow.servicesimpl.*.*(..))"/>
?????????</aop:config>
?????????
?????????</beans>
?????????<!--我已经配置好了-->
??????????? 9.配置 WEB-INF\flex\remoting-config.xml
???????????
????????????? <!-- register EmpServiceImpl 使用哪一个业务类,就在此注册,为了节省大家时间,我已经写好了.-->
????????????? <!--1.说明 factory也就是我们前面配置的SpringFactory 在services-config.xml中配置的 springfactory-->
????????????? <!--2.说明source使用的不再是类名了,而是直接使用在applicationContext.xml中配置的bean id-->
????????????? <!--前面我已经传了一部分上去了,欢迎大家访问下载学习
????????????? http://lwx123.iteye.com
????????????? http://xshow.iteye.com
????????????? -->
??????????? <destination id="empService">
??????????? ?<properties>
??????????? ??<factory>springfactory</factory>
??????????? ??<source>empServiceImpl</source>
??????????? ?</properties>
??????????? </destination>
??????????? <!-- register DepServiceImpl -->
?????????<destination id="depService">
??????????<properties>
???????????<factory>springfactory</factory>
???????????<source>depServiceImpl</source>
??????????</properties>
?????????</destination>???
??????????????? 10.调用刚才注册 remoting-config.xml中的service id可以自定义
??????????????? <!--这里的id也就是在remoting-config.xml中配置的
??????????????????? <mx:RemoteObject id="ird" destination="empService"/>
??????????????????? 说明:
???????????????????????? 1>initEmpAll 加载方法
???????????????????????? 2>使用ResultEvent
???????????????????????? 3>bemp是上面定义的ArrayCollection
??????????????? 11.发布,启动服务器,查看结果

Flex+spring+hibernate调整视频学习交流part_2

热点排行