【问题标题】:Savepoint using Hibernate使用休眠的保存点
【发布时间】:2011-09-29 12:01:19
【问题描述】:

问题是我在临时基础上在休眠中使用保存或更新...

现在当我最终触发更新时,它将永久存储在数据库中,否则回滚它..

如何使用 hibernate base 进行保存点是 spring。

喜欢

HibernateTemplate hibernateTemplateObj = getHibernateTemplate();

hibernateTemplateObj.saveOrUpdateAll(userList);

现在我想在保存或更新之前添加保存点。

任何帮助都将是 appriciate..

感谢您的建议。

【问题讨论】:

    标签: hibernate savepoints


    【解决方案1】:

    使用此代码

    hibernateConection.setAutocommit(false);
    
    Savepoint savepoint = hibernateConection.setSavepoint(); 
    

    其中,hibernateConection 是第三方库 liquibase.ext.hibernate.database.HibernateConnection 的对象

    【讨论】:

      猜你喜欢
      • 2021-09-22
      • 1970-01-01
      • 2011-12-16
      • 2023-03-31
      • 2012-09-09
      • 1970-01-01
      • 1970-01-01
      • 2017-10-19
      • 2012-08-09
      相关资源
      最近更新 更多