Hi,

When create a new InventoryItemDetail the InventoryItem will be updated by 
eeca. But If two threads create InventoryItemDetails simultaneously. Because we 
use ReadCommitted Isolation level, Neither will see InventoryItemDetails 
created by other threads before transaction commit.
updateInventoryItemFromDetail service will get incorrect qoh, and InventoryItem 
will be updated. Two threads will all be committed successfully.

I can confirm the behavior by set a breakpoint in 
org.ofbiz.minilang.method.entityops.StoreValue.exec(MethodContext) to emulate 
above process. The result can be checked by this SQL.

select * from inventory_item t1 left join (
select inventory_item_id, sum(quantity_on_hand_diff) as qoh, 
sum(available_to_promise_diff) as atp from inventory_item_detail
group by inventory_item_id) t2 on t1.inventory_item_id = t2.inventory_item_id
where t1.quantity_on_hand_total <> t2.qoh;

—
YaoCL

Reply via email to