Savepoint using Hibernate

旧街凉风 提交于 2019-12-07 14:34:03

问题


The issue is i m using save or update in hibernate on temporary base...

now when i finally fire update it will store it in DB permanently otherwise rollback it..

how to make save point using hibernate base is spring.

like

HibernateTemplate hibernateTemplateObj = getHibernateTemplate();

hibernateTemplateObj.saveOrUpdateAll(userList);

now i would like to add savepoint in connection before save or update.

Any help would be appriciate..

Thanks in adv.


回答1:


Use this code

hibernateConection.setAutocommit(false);

Savepoint savepoint = hibernateConection.setSavepoint(); 

where, hibernateConection is object of third party library liquibase.ext.hibernate.database.HibernateConnection



来源:https://stackoverflow.com/questions/6594759/savepoint-using-hibernate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!