<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url"
value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<!-- 连接池启动时的初始值 -->
<!-- <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/sys/model/model.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.hbm2ddl.auto=update
hibernate.show_sql=true
hibernate.format_sql=false
hibernate.cache.use_second_level_cache=false
hibernate.cache.use_query_cache=false
</value>
</property>
</bean> <!-- 事务相关控制 -->
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean> <tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" read-only="false"></tx:method>
</tx:attributes>
</tx:advice> <!--把事务控制在Service层 -->
<aop:config>
<aop:pointcut id="pc"
expression="execution(public * com.sys.service.*.*(..))" />
<aop:advisor pointcut-ref="pc" advice-ref="txAdvice" />
</aop:config>

上面是配置文件,但是总是出现No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here。这个错误。到现在还没有解决!今晚就看看能不能解决吧!

spring事务管理出错。No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here的更多相关文章

  1. spring 管理事务配置时,结果 报错: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here这个异常

    java.lang.IllegalStateException: No Hibernate Session bound to thread, and configuration does not al ...

  2. org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here

    org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not a ...

  3. 出现No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here异常

    问题描述: public void save(BaseEntity baseEntity) { Session session = null; try { session = currentSessi ...

  4. 报错解决:No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here

    大概分析一般使用了注解才会报这方面的错 1.没有在spring的ApplicationContext.xml中开启注解事务 <!-- 开启注解事务 --> <tx:annotatio ...

  5. No Hibernate Session bound to thread, and configuration does not allow creat

    No Hibernate Session bound to thread, and configuration does not allow creat 今天遇到这么一个错误,在网上差了很多都没有能解 ...

  6. 解决No Hibernate Session bound to thread, and configuration does not allow creat。。。

    applicationContext.xml配置 <?xml version="1.0" encoding="UTF-8"?> <beans ...

  7. No Hibernate Session bound to thread, and configuration does not allow

    今天晚上挺悲催的,遇到了这个问题花费我很长时间,现在总结如下: 到这这种情况的发生有两种情况: 1,没有配置事物只要在Spring配置文件中添加如下代码: <bean id="txMa ...

  8. org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not a

    如果出现了这个错误,看看在使用Hibernate的时候有没有在事务的环境下执行操作!

  9. org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not

    遇到这个问题之前,我去百度和谷歌去搜索了一下.发现各种说法.可是针对我的项目而言,也就是公司的项目而言,这个问题的根源并不是是网上所说的那样. 最后是通过自己的想法做測试得到了解决. 1.首先说说我的 ...

随机推荐

  1. ajax提交后台自动反序列化成对象

    下面是ajax提交的方法,主要用到了$form.serializeArray()将表单序列化成json对象,然后用each处理一下,代码如下: var $form = $('<form>& ...

  2. AO中的GraphicsLayer---------元素的容器

    come from AO中的GraphicsLayer---------元素的容器 图形元素(Graphic Element)是存储于GraphicsLayer中的,本文主要涉及的接口和类主要有以下几 ...

  3. PowerDesigner 业务处理模型( BPM ) 说明 及Enterprise Architect使用教程

    http://www.cnblogs.com/springside-example/archive/2011/10/17/2529640.html http://wenku.baidu.com/lin ...

  4. Log设计

    Log设计 http://biancheng.dnbcw.info/net/380312.html http://blog.csdn.net/anyqu/article/details/7937378 ...

  5. easyui grid中翻页多选方法

    <table class="easyui-datagrid" title="人员选择" id="dg" data-options=&q ...

  6. Flex Builder 开发语言切换问题

    1.Flex Builder 4.6切换语言 打开\Adobe\Adobe Flash Builder 4.6\FlashBuilder.ini -nlzh_CN-startupeclipse/plu ...

  7. WEB前端性能优化小结

    转:http://www.gafish.net/archives/1514 对前端开发工程师来说,前端性能优化的重要性是不言而喻的,最为大家所知的是YSLOW的23条优化规则,在我的理解中,性能优化不 ...

  8. 使用 preferredStatusBarStyle 设置状态栏颜色

    iOS9之前,在plist文件中 插入一个新的key,名字为View controller-based status bar appearance,并将其值设置为NO. 然后敲入代码: [UIAppl ...

  9. C++字节对齐问题

    关于C++字节对齐问题 关于C/C++的字节对齐 这两天写解析SWF文件的程序,在结构体指针和从文件里读出来的进行转换的时候遇到一些问题,就是有一个struct A,比如: struct A { ch ...

  10. 使用.net(C#)发送邮件学习手册(带成功案例)

    使用.net(C#)发送邮件学习手册(带成功案例) 1.了解发送邮件的三种方式 2.实例介绍使用client.DeliveryMethod = System.Net.Mail.SmtpDelivery ...