- 浏览: 746765 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
lengzl:
请问,那个Node 是哪个包里面的类?
JAVA 二叉树的递归和非递归遍历 -
gongchuangsu:
总结的很好,感谢感谢
JAVA 二叉树的递归和非递归遍历 -
Caelebs:
666666666 居然是10年发的,难怪截屏自动保存的名字是 ...
截图工具 -
jijiqw:
是注解不是注释。。。
Spring @Transactional (一) -
letueo:
[b][b][b][b][b][b][b][b][b][b][ ...
Spring @Transactional (一)
把spring和hibernate配置文件结合、和各自独立
有好多人喜欢把spring和hibernate配置文件结合在一起也就是配置在一个xml里如
beans.xml:
<?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:context="http://www.springframework.org/schema/context"
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.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:annotation-config/>
<context:component-scan base-package="com"/>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<!--数据库连接-->
<property name="driverClassName" value="org.gjt.mm.mysql.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/oa1?useUnicode=true&characterEncoding=UTF-8"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
<!-- 连接池启动时的初始值 -->
<property name="initialSize" value="1"/>
<!-- 连接池的最大值 -->
<property name="maxActive" value="500"/>
<!-- 最大空闲值.当经过一个高峰时间后,连接池可以慢慢将已经用不到的连接慢慢释放一部分,一直减少到maxIdle为止 -->
<property name="maxIdle" value="2"/>
<!-- 最小空闲值.当空闲的连接数少于阀值时,连接池就会预申请去一些连接,以免洪峰来时来不及申请 -->
<property name="minIdle" value="1"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>com/nqyw/oa/bean/Person.hbm.xml</value>
<value>com/nqyw/oa/bean/Organization.hbm.xml</value>
<value>com/nqyw/oa/bean/Module.hbm.xml</value>
<value>com/nqyw/oa/bean/Acl.hbm.xml</value>
<value>com/nqyw/oa/bean/Role.hbm.xml</value>
<value>com/nqyw/oa/bean/User.hbm.xml</value>
<value>com/nqyw/oa/bean/UsersRoles.hbm.xml</value>
<value>com/nqyw/oa/bean/ApproveInfo.hbm.xml</value>
<value>com/nqyw/oa/bean/Document.hbm.xml</value>
<value>com/nqyw/oa/bean/Workflow.hbm.xml</value>
</list>
</property>
<!-- 原先的配置路径 <property name="mappingDirectoryLocations">
<list>
<value>classpath:com/nqyw/oa/bean/</value>
</list>
</property>-->
<!-- hibernate属性信息 -->
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.hbm2ddl.auto=update
hibernate.show_sql=true
hibernate.format_sql=false
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=false
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
</value>
</property>
</bean>
<!-- 配置事务管理 -->
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- 事务声明采用注解方式 -->
<tx:annotation-driven transaction-manager="txManager"/>
<!-- 这里都是为了测试用的和持久层和业务层没有关系 -->
<bean id="personService" class="com.nqyw.oa.service.imp.PersonServiceBean"></bean>
<bean id="organizationService" class="com.nqyw.oa.service.imp.OrganizationServiceBean"></bean>
<bean id="moduleService" class="com.nqyw.oa.service.imp.ModuleServiceBean"></bean>
<bean id="roleService" class="com.nqyw.oa.service.imp.RoleServiceBean"></bean>
<bean id="initSystemDatas" class="com.nqyw.oa.service.imp.InitSystemDatasImpl"></bean>
<bean id="aclManager" class="com.nqyw.oa.service.imp.AclServiceBean"></bean>
<bean id="myfunctions" class="com.nqyw.oa.web.action.MyFunctions">
<property name="aclManager" ref="aclManager"></property>
</bean>
</beans>
一旦想让两个配置文件各自独立就不会了,现在回钦波帮你:如:
1. beans.xml
<?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:context="http://www.springframework.org/schema/context"
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.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:annotation-config/>
<context:component-scan base-package="com"/>
<!-- 配置sessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<!-- 配置事务管理 -->
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- 事务声明采用注解方式 -->
<tx:annotation-driven transaction-manager="txManager"/>
<!-- 这里都是为了测试用的和持久层和业务层没有关系 -->
<bean id="personService" class="com.nqyw.oa.service.imp.PersonServiceBean"></bean>
<bean id="organizationService" class="com.nqyw.oa.service.imp.OrganizationServiceBean"></bean>
<bean id="moduleService" class="com.nqyw.oa.service.imp.ModuleServiceBean"></bean>
<bean id="roleService" class="com.nqyw.oa.service.imp.RoleServiceBean"></bean>
<bean id="initSystemDatas" class="com.nqyw.oa.service.imp.InitSystemDatasImpl"></bean>
<bean id="aclManager" class="com.nqyw.oa.service.imp.AclServiceBean"></bean>
<bean id="myfunctions" class="com.nqyw.oa.web.action.MyFunctions">
<property name="aclManager" ref="aclManager"></property>
</bean>
</beans>
2. hibernate.config.xml
<?xml version='1.0' encoding='utf-8'?>
<!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.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://127.0.0.1/oa?useUnicode=true&characterEncoding=UTF-8</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">123456</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<mapping resource="com/nqyw/oa/bean/Person.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/Organization.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/Module.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/Acl.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/Role.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/User.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/UsersRoles.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/ApproveInfo.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/Document.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/Workflow.hbm.xml"/>
<mapping resource="com/bjsxt/jbpm/DocumentTest.hbm.xml"/>
<!-- DataSource properties (begin) ===
<property name="hibernate.connection.datasource">java:/JbpmDS</property>
==== DataSource properties (end) -->
<!-- JTA transaction properties (begin) ===
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
==== JTA transaction properties (end) -->
<!-- CMT transaction properties (begin) ===
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
==== CMT transaction properties (end) -->
<!-- logging properties (begin) ===
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.use_sql_comments">true</property>
==== logging properties (end) -->
<!-- ############################################ -->
<!-- # mapping files with external dependencies # -->
<!-- ############################################ -->
<!-- following mapping file has a dependendy on -->
<!-- 'bsh-{version}.jar'. -->
<!-- uncomment this if you don't have bsh on your -->
<!-- classpath. you won't be able to use the -->
<!-- script element in process definition files -->
<mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>
<!-- following mapping files have a dependendy on -->
<!-- 'jbpm-identity.jar', mapping files -->
<!-- of the pluggable jbpm identity component. -->
<!-- Uncomment the following 3 lines if you -->
<!-- want to use the jBPM identity mgmgt -->
<!-- component. -->
<!-- identity mappings (begin) -->
<mapping resource="org/jbpm/identity/User.hbm.xml"/>
<mapping resource="org/jbpm/identity/Group.hbm.xml"/>
<mapping resource="org/jbpm/identity/Membership.hbm.xml"/>
<!-- identity mappings (end) -->
<!-- following mapping files have a dependendy on -->
<!-- the JCR API -->
<!-- jcr mappings (begin) ===
<mapping resource="org/jbpm/context/exe/variableinstance/JcrNodeInstance.hbm.xml"/>
==== jcr mappings (end) -->
<!-- ###################### -->
<!-- # jbpm mapping files # -->
<!-- ###################### -->
<!-- hql queries and type defs -->
<mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" />
<!-- graph.def mapping files -->
<mapping resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml"/>
<mapping resource="org/jbpm/graph/def/Node.hbm.xml"/>
<mapping resource="org/jbpm/graph/def/Transition.hbm.xml"/>
<mapping resource="org/jbpm/graph/def/Event.hbm.xml"/>
<mapping resource="org/jbpm/graph/def/Action.hbm.xml"/>
<mapping resource="org/jbpm/graph/def/SuperState.hbm.xml"/>
<mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
<mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>
<!-- graph.node mapping files -->
<mapping resource="org/jbpm/graph/node/StartState.hbm.xml"/>
<mapping resource="org/jbpm/graph/node/EndState.hbm.xml"/>
<mapping resource="org/jbpm/graph/node/ProcessState.hbm.xml"/>
<mapping resource="org/jbpm/graph/node/Decision.hbm.xml"/>
<mapping resource="org/jbpm/graph/node/Fork.hbm.xml"/>
<mapping resource="org/jbpm/graph/node/Join.hbm.xml"/>
<mapping resource="org/jbpm/graph/node/State.hbm.xml"/>
<mapping resource="org/jbpm/graph/node/TaskNode.hbm.xml"/>
<!-- context.def mapping files -->
<mapping resource="org/jbpm/context/def/ContextDefinition.hbm.xml"/>
<mapping resource="org/jbpm/context/def/VariableAccess.hbm.xml"/>
<!-- taskmgmt.def mapping files -->
<mapping resource="org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/def/Swimlane.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/def/Task.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/def/TaskController.hbm.xml"/>
<!-- module.def mapping files -->
<mapping resource="org/jbpm/module/def/ModuleDefinition.hbm.xml"/>
<!-- bytes mapping files -->
<mapping resource="org/jbpm/bytes/ByteArray.hbm.xml"/>
<!-- file.def mapping files -->
<mapping resource="org/jbpm/file/def/FileDefinition.hbm.xml"/>
<!-- scheduler.def mapping files -->
<mapping resource="org/jbpm/scheduler/def/CreateTimerAction.hbm.xml"/>
<mapping resource="org/jbpm/scheduler/def/CancelTimerAction.hbm.xml"/>
<!-- graph.exe mapping files -->
<mapping resource="org/jbpm/graph/exe/Comment.hbm.xml"/>
<mapping resource="org/jbpm/graph/exe/ProcessInstance.hbm.xml"/>
<mapping resource="org/jbpm/graph/exe/Token.hbm.xml"/>
<mapping resource="org/jbpm/graph/exe/RuntimeAction.hbm.xml"/>
<!-- module.exe mapping files -->
<mapping resource="org/jbpm/module/exe/ModuleInstance.hbm.xml"/>
<!-- context.exe mapping files -->
<mapping resource="org/jbpm/context/exe/ContextInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/TokenVariableMap.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/VariableInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml"/>
<!-- job mapping files -->
<mapping resource="org/jbpm/job/Job.hbm.xml"/>
<mapping resource="org/jbpm/job/Timer.hbm.xml"/>
<mapping resource="org/jbpm/job/ExecuteNodeJob.hbm.xml"/>
<mapping resource="org/jbpm/job/ExecuteActionJob.hbm.xml"/>
<!-- taskmgmt.exe mapping files -->
<mapping resource="org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/exe/PooledActor.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml"/>
<!-- logging mapping files -->
<mapping resource="org/jbpm/logging/log/ProcessLog.hbm.xml"/>
<mapping resource="org/jbpm/logging/log/MessageLog.hbm.xml"/>
<mapping resource="org/jbpm/logging/log/CompositeLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/ActionLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/NodeLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/ProcessStateLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/SignalLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/TokenCreateLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/TokenEndLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/TransitionLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/VariableLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/VariableCreateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/VariableDeleteLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/VariableUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/log/TaskLog.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml"/>
</session-factory>
</hibernate-configuration>
有好多人喜欢把spring和hibernate配置文件结合在一起也就是配置在一个xml里如
beans.xml:
<?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:context="http://www.springframework.org/schema/context"
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.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:annotation-config/>
<context:component-scan base-package="com"/>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<!--数据库连接-->
<property name="driverClassName" value="org.gjt.mm.mysql.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/oa1?useUnicode=true&characterEncoding=UTF-8"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
<!-- 连接池启动时的初始值 -->
<property name="initialSize" value="1"/>
<!-- 连接池的最大值 -->
<property name="maxActive" value="500"/>
<!-- 最大空闲值.当经过一个高峰时间后,连接池可以慢慢将已经用不到的连接慢慢释放一部分,一直减少到maxIdle为止 -->
<property name="maxIdle" value="2"/>
<!-- 最小空闲值.当空闲的连接数少于阀值时,连接池就会预申请去一些连接,以免洪峰来时来不及申请 -->
<property name="minIdle" value="1"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>com/nqyw/oa/bean/Person.hbm.xml</value>
<value>com/nqyw/oa/bean/Organization.hbm.xml</value>
<value>com/nqyw/oa/bean/Module.hbm.xml</value>
<value>com/nqyw/oa/bean/Acl.hbm.xml</value>
<value>com/nqyw/oa/bean/Role.hbm.xml</value>
<value>com/nqyw/oa/bean/User.hbm.xml</value>
<value>com/nqyw/oa/bean/UsersRoles.hbm.xml</value>
<value>com/nqyw/oa/bean/ApproveInfo.hbm.xml</value>
<value>com/nqyw/oa/bean/Document.hbm.xml</value>
<value>com/nqyw/oa/bean/Workflow.hbm.xml</value>
</list>
</property>
<!-- 原先的配置路径 <property name="mappingDirectoryLocations">
<list>
<value>classpath:com/nqyw/oa/bean/</value>
</list>
</property>-->
<!-- hibernate属性信息 -->
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.hbm2ddl.auto=update
hibernate.show_sql=true
hibernate.format_sql=false
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=false
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
</value>
</property>
</bean>
<!-- 配置事务管理 -->
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- 事务声明采用注解方式 -->
<tx:annotation-driven transaction-manager="txManager"/>
<!-- 这里都是为了测试用的和持久层和业务层没有关系 -->
<bean id="personService" class="com.nqyw.oa.service.imp.PersonServiceBean"></bean>
<bean id="organizationService" class="com.nqyw.oa.service.imp.OrganizationServiceBean"></bean>
<bean id="moduleService" class="com.nqyw.oa.service.imp.ModuleServiceBean"></bean>
<bean id="roleService" class="com.nqyw.oa.service.imp.RoleServiceBean"></bean>
<bean id="initSystemDatas" class="com.nqyw.oa.service.imp.InitSystemDatasImpl"></bean>
<bean id="aclManager" class="com.nqyw.oa.service.imp.AclServiceBean"></bean>
<bean id="myfunctions" class="com.nqyw.oa.web.action.MyFunctions">
<property name="aclManager" ref="aclManager"></property>
</bean>
</beans>
一旦想让两个配置文件各自独立就不会了,现在回钦波帮你:如:
1. beans.xml
<?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:context="http://www.springframework.org/schema/context"
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.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:annotation-config/>
<context:component-scan base-package="com"/>
<!-- 配置sessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<!-- 配置事务管理 -->
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- 事务声明采用注解方式 -->
<tx:annotation-driven transaction-manager="txManager"/>
<!-- 这里都是为了测试用的和持久层和业务层没有关系 -->
<bean id="personService" class="com.nqyw.oa.service.imp.PersonServiceBean"></bean>
<bean id="organizationService" class="com.nqyw.oa.service.imp.OrganizationServiceBean"></bean>
<bean id="moduleService" class="com.nqyw.oa.service.imp.ModuleServiceBean"></bean>
<bean id="roleService" class="com.nqyw.oa.service.imp.RoleServiceBean"></bean>
<bean id="initSystemDatas" class="com.nqyw.oa.service.imp.InitSystemDatasImpl"></bean>
<bean id="aclManager" class="com.nqyw.oa.service.imp.AclServiceBean"></bean>
<bean id="myfunctions" class="com.nqyw.oa.web.action.MyFunctions">
<property name="aclManager" ref="aclManager"></property>
</bean>
</beans>
2. hibernate.config.xml
<?xml version='1.0' encoding='utf-8'?>
<!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.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://127.0.0.1/oa?useUnicode=true&characterEncoding=UTF-8</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">123456</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<mapping resource="com/nqyw/oa/bean/Person.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/Organization.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/Module.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/Acl.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/Role.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/User.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/UsersRoles.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/ApproveInfo.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/Document.hbm.xml"/>
<mapping resource="com/nqyw/oa/bean/Workflow.hbm.xml"/>
<mapping resource="com/bjsxt/jbpm/DocumentTest.hbm.xml"/>
<!-- DataSource properties (begin) ===
<property name="hibernate.connection.datasource">java:/JbpmDS</property>
==== DataSource properties (end) -->
<!-- JTA transaction properties (begin) ===
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
==== JTA transaction properties (end) -->
<!-- CMT transaction properties (begin) ===
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
==== CMT transaction properties (end) -->
<!-- logging properties (begin) ===
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.use_sql_comments">true</property>
==== logging properties (end) -->
<!-- ############################################ -->
<!-- # mapping files with external dependencies # -->
<!-- ############################################ -->
<!-- following mapping file has a dependendy on -->
<!-- 'bsh-{version}.jar'. -->
<!-- uncomment this if you don't have bsh on your -->
<!-- classpath. you won't be able to use the -->
<!-- script element in process definition files -->
<mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>
<!-- following mapping files have a dependendy on -->
<!-- 'jbpm-identity.jar', mapping files -->
<!-- of the pluggable jbpm identity component. -->
<!-- Uncomment the following 3 lines if you -->
<!-- want to use the jBPM identity mgmgt -->
<!-- component. -->
<!-- identity mappings (begin) -->
<mapping resource="org/jbpm/identity/User.hbm.xml"/>
<mapping resource="org/jbpm/identity/Group.hbm.xml"/>
<mapping resource="org/jbpm/identity/Membership.hbm.xml"/>
<!-- identity mappings (end) -->
<!-- following mapping files have a dependendy on -->
<!-- the JCR API -->
<!-- jcr mappings (begin) ===
<mapping resource="org/jbpm/context/exe/variableinstance/JcrNodeInstance.hbm.xml"/>
==== jcr mappings (end) -->
<!-- ###################### -->
<!-- # jbpm mapping files # -->
<!-- ###################### -->
<!-- hql queries and type defs -->
<mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" />
<!-- graph.def mapping files -->
<mapping resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml"/>
<mapping resource="org/jbpm/graph/def/Node.hbm.xml"/>
<mapping resource="org/jbpm/graph/def/Transition.hbm.xml"/>
<mapping resource="org/jbpm/graph/def/Event.hbm.xml"/>
<mapping resource="org/jbpm/graph/def/Action.hbm.xml"/>
<mapping resource="org/jbpm/graph/def/SuperState.hbm.xml"/>
<mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
<mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>
<!-- graph.node mapping files -->
<mapping resource="org/jbpm/graph/node/StartState.hbm.xml"/>
<mapping resource="org/jbpm/graph/node/EndState.hbm.xml"/>
<mapping resource="org/jbpm/graph/node/ProcessState.hbm.xml"/>
<mapping resource="org/jbpm/graph/node/Decision.hbm.xml"/>
<mapping resource="org/jbpm/graph/node/Fork.hbm.xml"/>
<mapping resource="org/jbpm/graph/node/Join.hbm.xml"/>
<mapping resource="org/jbpm/graph/node/State.hbm.xml"/>
<mapping resource="org/jbpm/graph/node/TaskNode.hbm.xml"/>
<!-- context.def mapping files -->
<mapping resource="org/jbpm/context/def/ContextDefinition.hbm.xml"/>
<mapping resource="org/jbpm/context/def/VariableAccess.hbm.xml"/>
<!-- taskmgmt.def mapping files -->
<mapping resource="org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/def/Swimlane.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/def/Task.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/def/TaskController.hbm.xml"/>
<!-- module.def mapping files -->
<mapping resource="org/jbpm/module/def/ModuleDefinition.hbm.xml"/>
<!-- bytes mapping files -->
<mapping resource="org/jbpm/bytes/ByteArray.hbm.xml"/>
<!-- file.def mapping files -->
<mapping resource="org/jbpm/file/def/FileDefinition.hbm.xml"/>
<!-- scheduler.def mapping files -->
<mapping resource="org/jbpm/scheduler/def/CreateTimerAction.hbm.xml"/>
<mapping resource="org/jbpm/scheduler/def/CancelTimerAction.hbm.xml"/>
<!-- graph.exe mapping files -->
<mapping resource="org/jbpm/graph/exe/Comment.hbm.xml"/>
<mapping resource="org/jbpm/graph/exe/ProcessInstance.hbm.xml"/>
<mapping resource="org/jbpm/graph/exe/Token.hbm.xml"/>
<mapping resource="org/jbpm/graph/exe/RuntimeAction.hbm.xml"/>
<!-- module.exe mapping files -->
<mapping resource="org/jbpm/module/exe/ModuleInstance.hbm.xml"/>
<!-- context.exe mapping files -->
<mapping resource="org/jbpm/context/exe/ContextInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/TokenVariableMap.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/VariableInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml"/>
<!-- job mapping files -->
<mapping resource="org/jbpm/job/Job.hbm.xml"/>
<mapping resource="org/jbpm/job/Timer.hbm.xml"/>
<mapping resource="org/jbpm/job/ExecuteNodeJob.hbm.xml"/>
<mapping resource="org/jbpm/job/ExecuteActionJob.hbm.xml"/>
<!-- taskmgmt.exe mapping files -->
<mapping resource="org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/exe/PooledActor.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml"/>
<!-- logging mapping files -->
<mapping resource="org/jbpm/logging/log/ProcessLog.hbm.xml"/>
<mapping resource="org/jbpm/logging/log/MessageLog.hbm.xml"/>
<mapping resource="org/jbpm/logging/log/CompositeLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/ActionLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/NodeLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/ProcessStateLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/SignalLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/TokenCreateLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/TokenEndLog.hbm.xml"/>
<mapping resource="org/jbpm/graph/log/TransitionLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/VariableLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/VariableCreateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/VariableDeleteLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/VariableUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/log/TaskLog.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml"/>
<mapping resource="org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml"/>
</session-factory>
</hibernate-configuration>
发表评论
-
Struts2 xwork中ActionContext和ServletActionContext介绍
2011-03-21 11:26 1432ActionContext(Action上下文) ... -
Struts,Hibernate,Spring经典面试题收藏
2010-12-06 08:44 1320Struts,Hibernate,Spring经 ... -
struts1.2中ActionForm的理解
2010-12-03 14:43 1719初学struts的人我认为首 ... -
struts-config.xml 详解
2010-12-03 12:04 941弄清楚struts-config.xml中各项元素的作用,对于 ... -
struts global-exceptions用法
2010-12-03 11:56 1564在用struts框架写web程序时,有可能会遇到很多异常,如u ... -
<servlet-mapping>元素及其子元素
2010-12-03 11:04 1396<servlet-mapping>元素 ... -
servlet mapping 规则
2010-12-03 10:43 1428servlet mapping有三种<url-patte ... -
常用log4j配置
2010-12-03 09:48 919常用log4j配置 常用log4j配置,一般可以采用两种方 ... -
Log4j简介
2010-12-03 09:47 798在强调可重用组件开发的今天,除了自己从头到尾开发一个可重用 ... -
log4j配置祥解
2010-12-03 09:46 980第一步:加入log4j-1.2.8.j ... -
数据库连接池DBCP
2010-12-02 14:54 1054概念:数据库连接池负责分配、管理和释放数据库连接,它允许应用程 ... -
Hibernate持久化对象三种状态的区分,以及save,update,saveOrUpdate,merge,persist等的使用
2010-11-12 20:22 1568Hibernate的对象有3种状态,分别为:瞬时态(Trans ... -
Hibernate持久化对象
2010-11-12 20:20 1220一,持久化对象: 1,置于session管理下的对象叫做持久化 ... -
hibernate核心类简介
2010-11-12 20:16 1161Hibernate Hibernate是一 ... -
J2EE是什么语言
2010-11-11 12:42 5986****** 版权声明 ******** * 在完整保留 ... -
Hibernate最基础的示例
2010-11-04 15:06 1453有关Spring的知识大部分都已经温习完毕,今天开始转向H ... -
struts+spring+hibernate是怎样的架构?
2010-11-01 17:21 1085struts+spring+hibernate是怎 ... -
快速整合struts+spring+hibernate
2010-11-01 17:17 969说明: 使用平台:Eclipse3.2、MyEclipse5 ... -
Spring整合Hibernate
2010-11-01 15:34 1167Spring整合Hibernate的价值在于Spring为Hi ... -
一些有用的网址
2010-11-01 15:10 1002http://wenku.baidu.com/view/7ab ...
相关推荐
Struts、Spring 和 Hibernate 是Java Web开发中的三大框架,它们各自负责不同的职责,共同构建了企业级应用的基础架构。在本教程中,你将学习如何整合这三个强大的工具,以实现高效且灵活的后端开发。 Struts 是一...
4. 配置Hibernate:编写实体类,配置Hibernate的主配置文件(hibernate.cfg.xml)和映射文件(.hbm.xml)。 5. 配置DBCP:设置数据库连接池的属性,如driverClassName、url、username、password等。 在实际项目开发...
在"A074]WebWork+Spring+Hibernate整合开发网络书城 第四讲(JustCode原创).wrf"这个文件中,我们可以期待看到具体的整合步骤、配置文件解析以及案例演示。这可能包括Spring如何作为容器管理WebWork的动作类,以及...
这个"StrutsSpringHibernate开发需求包"很可能是为了帮助开发者在项目中快速集成这三个框架而准备的。 首先,让我们来详细了解一下这三个框架: 1. **Struts**:这是一个基于MVC(Model-View-Controller)设计模式...
在“Struts2+Spring2+Hibernate3 web应用示例.doc”文档中,你可能会找到关于如何配置这三大框架的详细步骤,包括web.xml、struts.xml、spring配置文件(如applicationContext.xml)和hibernate配置文件(如...
Struts2、Spring和Hibernate是Java开发中三大主流框架,它们各自解决着应用程序的不同问题,共同构建了企业级Java应用的基础架构。理解并熟练运用这三个框架是成为一名合格的Java开发者的关键。 **Struts2框架**是...
**Spring-Struts-Hibernate ...通过这个整合,开发者可以享受到Spring、Struts2和Hibernate各自的优势,并通过Maven进行高效的项目管理。这种架构对于大型、复杂的Java Web应用来说,提供了良好的可维护性和扩展性。
- Hibernate工作原理主要包括读取配置文件和映射信息,创建SessionFactory,然后通过SessionFactory打开Session,执行持久化操作,最后提交事务和关闭Session。 - Hibernate的并发机制主要涉及Session的非线程安全...
这些框架各自解决了不同的问题,Spring关注于依赖注入和面向切面编程,Struts处理MVC(模型-视图-控制器)架构,而Hibernate则负责持久化层,简化数据库操作。 **Spring框架** 是一个全面的后端开发框架,其核心...
Struts2、Spring2.5和Hibernate3是Java开发领域中的三大开源框架,它们各自扮演着不同的角色,共同构建了一个强大的企业级应用解决方案。这里,我们深入探讨这三大框架的核心功能和结合使用的方式。 **Struts2** 是...
然而,由于SSH各自独立的配置和大量的XML配置文件,项目的复杂度也相对较高。因此,在实际开发中,开发者可能转向Spring Boot这样的现代框架,它以更简洁的方式实现了类似的功能,降低了项目初始化和维护的成本。 ...
2. **Struts框架**:掌握Struts的配置文件struts-config.xml,Action类的编写,以及如何使用ActionForm对象传递请求数据。 3. **Servlet和JavaBeans**:了解Servlet的基础知识,包括如何编写和映射Servlet,以及...
Struts、Hibernate和Spring是Java开发中的三大框架,它们各自承担着不同的职责并协同工作,以提高开发效率和代码质量。在本项目中,我们使用的是Struts2.1.6、Spring2.5.6和Hibernate3.3的老版本,尽管这些版本相对...
1. 配置Spring:创建一个Spring配置文件(如`applicationContext.xml`),声明数据库连接池、SessionFactory、Hibernate的DAO和Service类等。 2. 整合Hibernate:在Spring配置文件中,配置Hibernate的...
Struts、Hibernate 和 Spring 是Java Web开发中的三大框架,它们各自负责不同的职责,共同构建了一个高效、可维护的Web应用程序架构。Struts处理MVC(Model-View-Controller)架构,Hibernate专注于对象关系映射...
总的来说,Struts2.0、Hibernate和Spring的结合为Java Web开发提供了一个强大而灵活的解决方案,它们各自专注于不同的职责,共同构建出高效、可维护的后端系统。理解并熟练掌握这三大框架的使用,对于提升Java开发者...
1. **依赖注入**:Spring通过配置文件或注解来管理对象之间的依赖关系,使得代码更加松耦合,易于测试和维护。 2. **事务管理**:Spring提供了声明式事务管理,开发者可以在不编写具体事务管理代码的情况下,通过...
Struts、Hibernate和Spring是Java Web开发中的三大主流框架,它们各自负责Web应用的不同层面,共同构建出高效、可扩展的系统。Struts是一个MVC(Model-View-Controller)框架,专注于处理用户请求和控制应用程序流程...
Struts、Hibernate和Spring是Java开发中的三大框架,它们各自解决不同的问题,组合使用能构建出高效、可维护的企业级Web应用。以下是对这三大框架的详细解释。 **Struts** 是一个开源的MVC(Model-View-Controller...
本项目"Spring4.2_Struts2_Hibernate4.3框架整合"旨在演示如何将Spring 4.2、Struts2和Hibernate 4.3这三大流行Java Web框架结合使用。这些框架各自在应用开发中扮演着重要的角色:Spring提供了依赖注入和面向切面...