Hi,
I have an Shipment Agent that listneing for a ShipmentModQuantitiesChange. In that agent I am recalcuating some shipment refnums. The agent deletes the refnums then re-insert thems. Most of the time this works just fine. Occasionally it throws a DuplicateKeyException.
We thought that the bean cache was not being refreshed fast enough, so there is a WAIT for 5 seconds between the delete and the insert. Note: in the Direct SQL Update, the box is checked to refresh the cache.
The agent terminates when the exception occurs, but when checking the Shipment_Refnum table, I see that all the refnums that I deleted are still there. I would have expected the deleted refnums to be gone and only the ones after the failed insert to be missing. That does not seem to be the case.
When are the Direct Sql Updates persisted to the database? If the agent fails, are all updates rolled back?
I'm thinking of rewriting the agent to either just update, rather than delete and insert or to write this as a stored procedure to be called instead. I would appreciate any comments as to which is the better way to accomplish this.
Note: I am running OTM 5.5 CU3-RU3.
THANKS!
I have an Shipment Agent that listneing for a ShipmentModQuantitiesChange. In that agent I am recalcuating some shipment refnums. The agent deletes the refnums then re-insert thems. Most of the time this works just fine. Occasionally it throws a DuplicateKeyException.
We thought that the bean cache was not being refreshed fast enough, so there is a WAIT for 5 seconds between the delete and the insert. Note: in the Direct SQL Update, the box is checked to refresh the cache.
The agent terminates when the exception occurs, but when checking the Shipment_Refnum table, I see that all the refnums that I deleted are still there. I would have expected the deleted refnums to be gone and only the ones after the failed insert to be missing. That does not seem to be the case.
When are the Direct Sql Updates persisted to the database? If the agent fails, are all updates rolled back?
I'm thinking of rewriting the agent to either just update, rather than delete and insert or to write this as a stored procedure to be called instead. I would appreciate any comments as to which is the better way to accomplish this.
Note: I am running OTM 5.5 CU3-RU3.
THANKS!
Comment