How to prevent to get soft-deleted data even set setSoftDeletion as false in CUBA plateform?

we have codes to setSoftDeletion as false and then setSoftDeletion as true after doing some operations in same function. sometimes throw exceptions during the operation, couldn’t setSoftDeletion to true. and then the whole system will return the data already soft-deleted through the query and cause many issues.

are there any global configurations to prevent to get soft-deleted data for any reasons?

thanks.

Hello Kevin,

The simplest way to avoid such situation is to use try-finally:

try {
//set softDeletion to false
//do operations
} finally {
//set softDeletion to true
}

Regards,
Dmitry