Spring Hibernate 开启事务
来源:互联网 发布:大数据工程师压力大吗 编辑:程序博客网 时间:2024/06/05 08:36
仅仅记录一下配置文件
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p"xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-4.0.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-4.0.xsd"><bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"destroy-method="close" p:driverClass="com.mysql.jdbc.Driver"p:jdbcUrl="jdbc:mysql://hostname/test" p:user=""p:password="" p:maxPoolSize="200" p:minPoolSize="2"p:initialPoolSize="2" p:maxIdleTime="20"></bean><bean id="sessionFactory"class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"p:dataSource-ref="dataSource"><!-- annotatedClasses属性用于列出全部持久化类 --><property name="annotatedClasses"><list><!-- 以下用来列出Hibernate的持久化类 --><value>com.songxu.entity.Log</value></list></property><!-- 定义Hibernate的SessionFactory的属性 --><property name="hibernateProperties"><!-- 指定数据库方言、是否自动建表、是否生成SQL语句等 --><value>hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialecthibernate.hbm2ddl.auto=updatehibernate.show_sql=truehibernate.format_sql=true#开启二级缓存hibernate.cache.use_second_level_cache=true#设置二级缓存的提供者hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory</value></property></bean><bean id="dao" class="com.songxu.entity.LogDao"><property name="sessionFactory" ref="sessionFactory"></property></bean><!-- 开启事务 --><bean id="transactionManager"class="org.springframework.orm.hibernate4.HibernateTransactionManager"><property name="sessionFactory" ref="sessionFactory"></property></bean><!-- 配置事务增强处理Bean,指定事务管理器 --><tx:advice id="txAdvice" transaction-manager="transactionManager"><!-- 用于配置详细的事务语义 --><tx:attributes><!-- 所有以'get'开头的方法是read-only的 --><tx:method name="get*" read-only="true" /><!-- 其他方法使用默认的事务设置 --><tx:method name="*" propagation="REQUIRED"/></tx:attributes></tx:advice><aop:config expose-proxy="true"><!-- 只对业务逻辑层实施事务 --><aop:pointcut id="txPointcut" expression="execution(* com.songxu.entity.*.*(..))" /><!-- Advisor定义,切入点和通知分别为txPointcut、txAdvice --><aop:advisor pointcut-ref="txPointcut" advice-ref="txAdvice" /></aop:config></beans>
0 0
- Spring Hibernate 开启事务
- mybatis开启spring事务
- Hibernate事务的开启问题
- Spring @Transactional 如何开启事务
- Spring @Transactional 如何开启事务
- Spring @Transactional 如何开启事务
- Spring事务管理(5)-开启事务
- spring整合redis(开启事务)
- Spring -- 一个事务中独立开启事务
- Spring 对hibernate事务处理的实现过程(2) spring怎么获取hibernate使用的session并开启事务的
- Spring+Hibernate配置事务
- spring管理hibernate事务
- spring hibernate 事务配置
- spring hibernate 事务
- spring中的hibernate事务
- spring 事务 hibernate
- Spring管理Hibernate事务
- Spring+hibernate事务详解
- UI16_数据持久化(NSUserDefaults,简单对象,复杂对象归档反归档,文件管理者"删除添加文件")
- 题目:矩阵的之字型遍历
- 多线程并发问题(二)
- HDU 1203 I NEED A OFFER!
- 八大排序算法总结
- Spring Hibernate 开启事务
- 题目:空格替换
- 黑马程序员---学习笔记3:进制
- curl--curl是利用URL语法在命令行方式下工作的开源文件传输工具,
- 空指针和void*指针
- 题目:翻转二叉树
- MySQL中的replace into
- 10G个整数找中位数
- 黑马程序员---学习笔记4:数组