Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Savepoint using Hibernate

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.

like image 490
Sweety Avatar asked May 09 '26 05:05

Sweety


1 Answers

Use this code

hibernateConection.setAutocommit(false);

Savepoint savepoint = hibernateConection.setSavepoint(); 

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

like image 104
Yogesh Prajapati Avatar answered May 15 '26 21:05

Yogesh Prajapati



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!