getHibernateTemplate().update()数据更新不到数据库也输不出Sql施行语句,但前台有显示修改结果getHibernateTemplate().update()数据更新不到数据库也输不出Sql施行语句,但前台有显示修改结果
getHibernateTemplate().update()数据更新不到数据库,也输不出Sql执行语句,但前台有显示修改结果,
我在调用getHibernateTemplate().update()方法进行数据时,数据更新成功后前台返回结果正确,但在数据库中数据没有显示。在网上查了之后再配置文件中加上 prop key= hibernate.connection.autocommit true /...
getHibernateTemplate().update()数据更新不到数据库也输不出Sql施行语句,但前台有显示修改结果
getHibernateTemplate().update()数据更新不到数据库,也输不出Sql执行语句,但前台有显示修改结果,
我在调用getHibernateTemplate().update()方法进行数据时,数据更新成功后前台返回结果正确,但在数据库中数据没有显示。在网上查了之后再配置文件中加上 prop key= hibernate.connection.autocommit true /prop 还是不行,但我在加上getSession.flush()方法后就可以了,但我想知道可否不加上getSession.flush()解决。
这是我的Spring配置文件:
bean id= sessionFactory
class=
org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
property name= dataSource ref= dataSource /
property name= annotatedClasses
list
value com.news.model.User /value
value com.news.model.News /value
/list
/property
property name= hibernateProperties
props
prop key= hibernate.dialect org.hibernate.dialect.MySQLDialect /prop
prop key= show_sql true /prop
prop key= hbm2ddl.auto create /prop
prop key= hibernate.format_sql true /prop
prop key= hibernate.connection.autocommit true /prop
/props
/property
/bean
------最佳解决
--------------------------------------------------------
可以 spring 代码中 设置 flush模式 什么的 好像
------其他解决方案--------------------------------------------------------
你Update的完整代码是,取得Connection有没有取消autocommit,
------其他解决方案--------------------------------------------------------
看看是否设置了自动提交~
引用:
你Update的完整代码是,取得Connection有没有取消autocommit,
------其他解决方案--------------------------------------------------------
把日志级别设为debug,看输出信息
不用template试试
------其他解决方案--------------------------------------------------------
有取消autocommit吗,
------其他解决方案--------------------------------------------------------
引用:
有取消autocommit吗,
没有取消,问题提了好久了,现在那个项目都弄好了。不过还是谢谢你。
本文档为【getHibernateTemplate().update()数据更新不到数据库也输不出Sql施行语句,但前台有显示修改结果】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。