Data integrity

Hi All,

I didn’t find explicit info in documentation so will ask here.

How does bonita handle “lost updates”? As far as I understood bonita uses hibernate which utilizes optimistic row locking through PERSISTENCEVERSION field in BDM. But it is not clear where transaction boundaries are.

I have a script in a operation in Service Step:

import com.company.model.Specification
import com.company.model.DealTransaction

for(DealTransaction tr : dealTransactions){
//get Buyer and Seller Spec
Specification bs = tr.getBuyer()
Specification ss = tr.getSeller()

//Evaluate remains and lock specifications
if(bs.remains >= tr.amount && ss.remains >= tr.amount){
//Potential “update loss”

  bs.setRemains(bs.remains - tr.amount)
    }

What will happen if 2 processes try to execute this script simultaneously? May the bs.remains value be set to negative?

BR,
Roman