`
xxp3369
  • 浏览: 151245 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论
阅读更多
oa_01:

1、建立机构管理的实体类,并映射【重点理解多对一双向关联映射的原理】(Organization.hbm.xml)
2、根据顺序图的分析,得到业务逻辑接口设计方案(OrgManager.java)
3、实现业务逻辑类(OrgManagerImpl.java)
4、编写测试单元对关键的接口(或没有把握的接口)进行测试,在测试中发现问题并修正(OrgManagerTest.java)
- 重点理解在SSH架构中,spring如何对事务和hibernate session进行管理
* spring通过AOP机制,在业务逻辑对象的方法上添加事务处理
* 需正确的配置事务的传播特性


每个模块的基本开发过程:
1、理解需求(用例分析),创建领域模型
2、细化领域模型,创建实体类,并映射实体类,测试映射的正确性(自动生成数据库表)
3、根据对用例的分析结果,创建业务逻辑接口以及方法,并实现以及测试
4、分析页面操作流程,根据MVC的想法,搞清楚都需要哪些JSP以及Action(可用状态图来分析)
5、逐步实现呈现层的各种内容



<?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: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/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
           
</beans>



<?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: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/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

	<bean id="orgManager" class="com.bjsxt.oa.manager.impl.OrgManagerImpl">
		<property name="sessionFactory" ref="sessionFactory"/>
	</bean>

</beans>



<?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: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/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
	<!-- 配置SessionFactory -->
	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="configLocation">
			<value>classpath:hibernate.cfg.xml</value>
		</property>
	</bean>
	
	<!-- 配置事务管理器 -->
	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory">
			<ref bean="sessionFactory"/>
		</property>	
	</bean>    
	
	<!-- 事务的传播特性 -->
	<tx:advice id="txAdvice" transaction-manager="transactionManager">
		<tx:attributes>
			<tx:method name="add*" propagation="REQUIRED"/>
			<tx:method name="del*" propagation="REQUIRED" />
			<tx:method name="modify*" propagation="REQUIRED"/>
			<tx:method name="*" read-only="true"/>
		</tx:attributes>
	</tx:advice>
	
	<!-- 那些类那些方法使用事务 -->
	<aop:config>
		<aop:pointcut id="allManagerMethod" expression="execution(* com.bjsxt.oa.manager.*.*(..))"/>
		<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod"/>
	</aop:config>
</beans>



<!DOCTYPE hibernate-configuration PUBLIC
	"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
	"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
	<session-factory>
		<property name="hibernate.connection.url">jdbc:mysql://127.0.0.1/oa</property>
		<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
		<property name="hibernate.connection.username">root</property>
		<property name="hibernate.connection.password">bjsxt</property>
		<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
		<property name="hibernate.show_sql">true</property>
		<property name="hibernate.hbm2ddl.auto">update</property>
		
		<mapping resource="com/bjsxt/oa/model/Person.hbm.xml"/>
		<mapping resource="com/bjsxt/oa/model/Organization.hbm.xml"/>
	</session-factory>
</hibernate-configuration>



### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### direct messages to file hibernate.log ###
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### set log levels - for more verbose logging change 'info' to 'debug' ###

log4j.rootLogger=info, stdout

#log4j.logger.org.hibernate=info
#log4j.logger.org.hibernate=debug

### log HQL query parser activity
#log4j.logger.org.hibernate.hql.ast.AST=debug

### log just the SQL
#log4j.logger.org.hibernate.SQL=debug

### log JDBC bind parameters ###
#log4j.logger.org.hibernate.type=info
#log4j.logger.org.hibernate.type=debug

### log schema export/update ###
#log4j.logger.org.hibernate.tool.hbm2ddl=debug

### log HQL parse trees
#log4j.logger.org.hibernate.hql=debug

### log cache activity ###
#log4j.logger.org.hibernate.cache=debug

### log transaction activity
#log4j.logger.org.hibernate.transaction=debug

### log JDBC resource acquisition
#log4j.logger.org.hibernate.jdbc=debug

### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace



# -- standard errors --
errors.header=<UL>
errors.prefix=<LI>
errors.suffix=</LI>
errors.footer=</UL>
# -- validator --
errors.invalid={0} is invalid.
errors.maxlength={0} can not be greater than {1} characters.
errors.minlength={0} can not be less than {1} characters.
errors.range={0} is not in the range {1} through {2}.
errors.required={0} is required.
errors.byte={0} must be an byte.
errors.date={0} is not a date.
errors.double={0} must be an double.
errors.float={0} must be an float.
errors.integer={0} must be an integer.
errors.long={0} must be an long.
errors.short={0} must be an short.
errors.creditcard={0} is not a valid credit card number.
errors.email={0} is an invalid e-mail address.
# -- other --
errors.cancel=Operation cancelled.
errors.detail={0}
errors.general=The process did not complete. Details should follow.
errors.token=Request could not be completed. Operation is not in sequence.
# -- welcome --
welcome.title=Struts Blank Application
welcome.heading=Welcome!
welcome.message=To get started on your own application, copy the struts-blank.war to a new WAR file using the name for your application. Place it in your container's "webapp" folder (or equivalent), and let your container auto-deploy the application. Edit the skeleton configuration files as needed, restart your container, and you are on your way! (You can find the application.properties file with this message in the /WEB-INF/src/java/resources folder.)



<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">

<struts-config>
    <message-resources parameter="MessageResources" />
</struts-config>



<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 
	xmlns="http://java.sun.com/xml/ns/j2ee" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
	http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  

  <!-- Standard Action Servlet Configuration (with debugging) -->
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>2</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>


  <!-- Standard Action Servlet Mapping -->
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>  
  
  <context-param>
  	<param-name>contextConfigLocation</param-name>
	<!-- 
  	<param-value>classpath*:applicationContext-*.xml,/WEB-INF/applicationContext-*.xml</param-value>
  	 -->
  	 <param-value>classpath*:applicationContext-*.xml</param-value>
  </context-param>
  
  <listener>
  	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  
<filter>
    <filter-name>Spring character encoding filter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
    	<param-name>encoding</param-name>
    	<param-value>GBK</param-value>
    </init-param>
  </filter>
 <filter-mapping>
    <filter-name>Spring character encoding filter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  
<filter>
    <filter-name>hibernateFilter</filter-name>
    <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
  </filter>
 <filter-mapping>
    <filter-name>hibernateFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping> 
  
  
  
</web-app>



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
	<class name="com.bjsxt.oa.model.Organization" table="t_organization">
		<id name="id">
			<generator class="native"/>
		</id>
		<property name="name"/>
		<property name="sn"/>
		<property name="description"/>
		<many-to-one name="parent" column="pid"></many-to-one>
		<set name="children" lazy="extra" inverse="true">
			<key column="pid"></key>
			<one-to-many class="com.bjsxt.oa.model.Organization"/>
		</set>
	</class>
</hibernate-mapping>



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
	<class name="com.bjsxt.oa.model.Person" table="t_person">
		<id name="id">
			<generator class="native"/>
		</id>
		<property name="name"/>
		<property name="sex"/>
		<property name="age"/>
		<property name="address"/>
		<property name="duty"/>
		<property name="phone"/>
		<many-to-one name="org"></many-to-one>
	</class>
</hibernate-mapping>



package com.bjsxt.oa.model;

public class Person {
	private int id;
	private String name;
	private String sex;
	private String address;
	private int age;
	private String duty;
	private String phone;
	private Organization org;
	
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public String getDuty() {
		return duty;
	}
	public void setDuty(String duty) {
		this.duty = duty;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public Organization getOrg() {
		return org;
	}
	public void setOrg(Organization org) {
		this.org = org;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
}



package com.bjsxt.oa.model;

import java.util.Set;

public class Organization {
	private int id;
	private String name;
	private String sn;
	private String description;
	private Organization parent;
	private Set children;
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getSn() {
		return sn;
	}
	public void setSn(String sn) {
		this.sn = sn;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public Organization getParent() {
		return parent;
	}
	public void setParent(Organization parent) {
		this.parent = parent;
	}
	public Set getChildren() {
		return children;
	}
	public void setChildren(Set children) {
		this.children = children;
	}
}
分享到:
评论

相关推荐

    OA.rar_java oa_oa_oa.r

    2. "oa040201" - 这个文件名看起来像是项目的一个模块或者版本编号,"oa"再次确认了与OA系统的关联,"040201"可能是日期(2004年2月1日)或者是版本号(0.4.0.2.01)。 综合以上信息,我们可以推断这个压缩包包含的...

    关于OA的资源,大家看看有帮助吗。希望有

    这个压缩包"oa_01"可能包含了一个初级OA项目的源代码,可能是用某种编程语言(如Java、Python或.NET)编写的。源代码是程序设计的基础,通过阅读和分析这些代码,我们可以了解到OA系统的架构设计、模块划分以及具体...

    OA管理系统

    在“oa_01”这个文件中,可能包含了项目的初始结构,包括源代码、配置文件、数据库脚本等。源代码部分可能分为几个主要模块:用户管理、权限控制、工作流引擎、文档管理、通知公告等。用户管理模块负责用户的注册、...

    oa系统代码1

    在提供的压缩文件【oa_gl_01】中,可能包含了通达OA系统关于财务管理或会计模块的相关代码或配置文件。这些文件可能涉及到财务报表的生成、预算控制、报销审批等业务流程的自动化处理。通过分析这些代码,可以深入...

    ACCP5.0SSH ORM项目

    在项目中的"oa_01"文件可能是项目的初始模块,可能包含了项目的配置文件、实体类、DAO(数据访问对象)、Service(业务服务)层、Controller(控制层)以及视图相关的文件。通过研究这些文件,可以了解到SSH框架如何...

    oa系统测试用例.pdf

    01 已经进入云网OA系统 2)图书类别不为空 1)点击图书类别后的编辑按钮 2)在图书类别编辑文本框中输入新的图书类别名称 1)弹出图书类别编辑文本框 2)弹出图书类别管理面板 3)图书类别名称已经改变,并和在...

    OA系统常用SQL语句

    例如,"01人事数据导入脚本.sql"可能包含了导入员工信息的SQL脚本,包括姓名、职位、入职日期等关键字段。"人事数据更新(无部门).sql.sql"可能是用于处理员工部门信息变更的情况,确保数据的实时性和准确性。 2. **...

    CRSC-EP&OA-01OA系统用户基本操作手册.doc

    《CRSC-EP&OA-01OA系统用户基本操作手册》是中国铁路通信信号股份有限公司在2014年12月发布的一份详细指导文档,旨在帮助用户掌握OA(Office Automation)系统的各项基本操作。这份手册对于提高员工在日常工作中的...

    钉钉推送消息 oa消息类型.txt

    new { key = "站:", value = "li4-01" }, new { key = "状态:", value = jons } } } }; ``` 这里设置了消息头部的背景色、消息主体中的作者信息以及两行表单数据。 ### 三、发送OA消息 #### 1. 构建消息请求 ...

    通达2013原版+破解版+OA精灵+IM1000用户补丁01

    绝对能用的通达OA2013版原版+破解版+OA精灵+IM1000用户补丁。 这是从麦枫和富阳上搜集的资料,汇总整合的。 现在好多破解版都不提供原版,以至于根本就不能用。本人经反复测试。这个绝对能用。 经过破解后,通达...

    DBP-SD-HX_功能说明书_创建发货单增强与OA接口_XXXX0121 V0[1]1.docx

    - VL01N:创建发货单 #### 五、输入屏幕 - **订单创建**:标准的发货单创建界面,包括基本的订单信息输入框、商品明细列表等。 #### 六、输出结果要求、输出屏幕 - **输出屏幕**:订单创建成功后的显示界面,...

    Java就业班OA项目实战培训视频【12讲】

    资源名称:Java就业班OA项目实战培训视频【12讲】资源目录:【】Java就业班OA项目实战01【】Java就业班OA项目实战02【】Java就业班OA项目实战03【】Java就业班OA项目实战04【】Java就业班OA项目实战05【】Java就业班...

    OA流程家庭作业—图书借阅流程(国际知名OA商绝密)

    流程名称为“图书借阅流程”,属于01_图书管理类别。流程设计者和批准人是关键角色,这里分别是XX和李XX。流程的目的通常是为了规范图书的借阅行为,确保图书资源的有效利用,避免遗失或损坏,并记录借阅信息。流程...

    泛微OA流程如何强制归档

    - `createdateBegin`:设置强制归档的起始日期,如`"2010-01-01"`。 - `createdateEnd`:设置强制归档的结束日期,自行根据需要设定。 - `workflowid`:根据第3步中获取的流程ID,设置需要归档的特定流程ID。例如...

    OA办公自动化系统01

    如果链接失效,请与我联系!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    oa办公系统源码 ssh

    OA(Office Automation)办公自动化系统是一种企业用于提升工作效率、实现工作流程自动化和信息共享的软件。SSH(Spring、Struts、Hibernate)是Java Web开发中常用的一种技术框架,用于构建高效、灵活的企业级应用...

    通达OA办公系统使用教程01(PPT44页).pptx

    通达OA办公系统是一款高效的企业级协同办公软件,旨在提升企业内部的工作效率和协作能力。本教程主要针对重庆国梁建设(集团)有限公司的员工,提供了详细的系统使用指南,涵盖了一系列核心功能,如密码管理、工作...

    通达OA0302升级包

    通达OA0302升级包,给又需要的朋友下载

Global site tag (gtag.js) - Google Analytics