4 Star 4 Fork 0

yacht / maven-framework-project

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
spring-hibernate.xml 5.43 KB
一键复制 编辑 原始数据 按行查看 历史
v5tech 提交于 2013-04-19 16:55 . 修正一些配置
<?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:mvc="http://www.springframework.org/schema/mvc"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:property-placeholder location="classpath:jdbc.properties"/>
<context:component-scan base-package="com.fengjing.framework.hibernate"></context:component-scan>
<tx:annotation-driven transaction-manager="hibernate4TransactionManager"/>
<aop:aspectj-autoproxy expose-proxy="true"></aop:aspectj-autoproxy>
<!-- Hibernate 4 DataSource数据源 -->
<bean id="hibernate4DataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="username" value="${username}"></property>
<property name="password" value="${password}"></property>
<property name="url" value="${hibernate4.url}"></property>
<property name="driverClassName" value="${P6Spy.driverClassName}"></property>
</bean>
<bean id="hibernate4sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="hibernate4DataSource"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<!-- <prop key="hibernate.hbm2ddl.auto">update</prop> -->
<prop key="hibernate.jdbc.batch_size">20</prop>
</props>
</property>
<property name="annotatedClasses">
<list>
<value>com.fengjing.framework.hibernate.model.Department</value>
<value>com.fengjing.framework.hibernate.model.Employee</value>
</list>
</property>
<!--
<property name="mappingResources">
<list>
<value>com/fengjing/framework/hibernate/model/Department.hbm.xml</value>
<value>com/fengjing/framework/hibernate/model/Employee.hbm.xml</value>
</list>
</property>
-->
</bean>
<bean id="hibernate4TransactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="hibernate4sessionFactory"></property>
</bean>
<!--
<bean id="employeeDao" class="com.fengjing.framework.hibernate.dao.impl.EmployeeDao">
<property name="sessionFactory" ref="hibernate4sessionFactory"></property>
</bean>
<bean id="departmentDao" class="com.fengjing.framework.hibernate.dao.impl.DepartmentDao">
<property name="sessionFactory" ref="hibernate4sessionFactory"></property>
</bean>
<bean id="employeeServiceImpl" class="com.fengjing.framework.hibernate.service.impl.EmployeeServiceImpl">
<property name="dao" ref="employeeDao"></property>
</bean>
<bean id="departmentServiceImpl" class="com.fengjing.framework.hibernate.service.impl.DepartmentServiceImpl">
<property name="dao" ref="departmentDao"></property>
</bean>
<bean id="employeeServiceImplProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target" ref="employeeServiceImpl"></property>
<property name="transactionManager" ref="transactionManager"></property>
<property name="transactionAttributes">
<props>
<prop key="query*">PROPAGATION_REQUIRED</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="del*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<bean id="departmentServiceImplProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target" ref="departmentServiceImpl"></property>
<property name="transactionManager" ref="transactionManager"></property>
<property name="transactionAttributes">
<props>
<prop key="query*">PROPAGATION_REQUIRED</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="del*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="query*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="del*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<aop:config expose-proxy="true">
<aop:pointcut expression="execution(* com.fengjing.framework.hibernate.service..*.*(..))" id="pointcut"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="pointcut"/>
</aop:config>
-->
</beans>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yacht/maven-framework-project.git
git@gitee.com:yacht/maven-framework-project.git
yacht
maven-framework-project
maven-framework-project
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891