on ‎2019 Mar 26 11:07 AM
Hi team,
I am going to throw exception , but before it I want to save some data to db. for now the rollback is triggered. Is there some way to save data before exception throw and avoid rollback of this save?
thank you, Vitaliy
Request clarification before answering.
Hi - if I understood your requirement correctly, you want the data to be saved irrespective of an exception is thrown. To deal with such a requirement, I would stick to Java basics and would use finally{} block.
finally {
//put your data saving code here
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
You can use transaction commit() before the exception is thrown so that the data is saved.
Reference : https://help.hybris.com/1811/hcd/8c7387f186691014922080f2e053216a.html
Hope this helps.
Thanks, .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi , We can throw the exception by interceptor .Write validate interceptor and onValidate write u r logic which you want check if fails throw exception or else save the data data it wont rollback
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.