book
Article ID: KB0073910
calendar_today
Updated On:
Description
DataIntegrityViolation error looks like the log snippet below:
---
22 May 2020 16:03:12,134 INFO [] [] [FOM-OrderService] [com.tibco.aff.oms.service.soap.SOAPActionValidationInterceptor] [handleMessage] - [ThreadID:186] [Tenant ID:TIBCO] RequestAction : SubmitOrderRequest . Actual SOAPAction : http://www.tibco.com/aff/service/soap/SubmitOrder. Expected SOAPAction http://www.tibco.com/aff/service/soap/SubmitOrder OR http://www.tibco.com/aff/service/soap/SyncSubmitOrder
22 May 2020 16:03:12,134 INFO [] [] [OrderSequencerImpl] [com.tibco.aff.oms.service.soap.SubmitOrderInterceptor] [submitOrder] - [ThreadID:186] [Tenant ID:TIBCO] START --->SubmitOrderInterceptor.handleMessage()
22 May 2020 16:03:12,134 INFO [] [] [OrderSequencerImpl] [com.tibco.aff.oms.service.soap.SubmitOrderInterceptor] [submitOrder] - [ThreadID:186] [Tenant ID:TIBCO] END --->SubmitOrderInterceptor.handleMessage()
22 May 2020 16:03:12,223 INFO [] [order_ref_1] [Member1] [com.tibco.aff.oms.server.soap.OrderServiceEndPoint] [submitOrder] - [ThreadID:186] [Tenant ID:TIBCO] Received Order request with Ref order_ref_1
22 May 2020 16:03:12,223 INFO [] [order_ref_1] [FOM-OrderService] [com.tibco.aff.oms.server.soap.OrderServiceEndPoint] [submitOrder] - [ThreadID:186] [Tenant ID:TIBCO] enableOrderSequencing flag is set to disable
22 May 2020 16:03:12,676 ERROR [] [order_ref_1] [FOM-OrderService] [com.tibco.aff.oms.server.impl.OrderServiceImpl] [submitOrder] - [ThreadID:186] [Tenant ID:TIBCO] Error while committing order with orderRef order_ref_1. Exception org.springframework.dao.DataIntegrityViolationException: could not execute batch; SQL [insert into audit_trail (dateCreated, orderId, orderRef, orderLineNumber, planId, planItemId, type, message, msg_origin_sys_inst_id, messageType, extension, auditSid) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; constraint [OMSTIBCO.FKDB7D1C3FD33C7235]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute batch
22 May 2020 16:03:12,677 INFO [] [order_ref_1] [FOM-OrderService] [com.tibco.aff.oms.server.impl.OrderServiceImpl] [submitOrder] - [ThreadID:186] [Tenant ID:TIBCO] DataIntegrityViolationException occurred, trying to recover...
22 May 2020 16:03:12,677 ERROR [] [order_ref_1] [FOM-OrderService] [com.tibco.aff.oms.server.impl.OrderServiceImpl] [submitOrder] - [ThreadID:186] [Tenant ID:TIBCO] Error while committing order with orderRef order_ref_1. Exception java.sql.BatchUpdateException: ORA-02291: integrity constraint (TIBCO.FKDB7D1C3FD33C7236) violated - parent key not found
---
Issue/Introduction
This article explains the reason why DataIntegrityViolation might occur just after submitting an order
Resolution
In this case, the error occurs because the request is sent with both flags:
<ord1:orderId>1</ord1:orderId>
<ord1:orderRef>order_ref_1</ord1:orderRef>
and most likely an order with order ID equals to 1 is already present in the database but with a different order reference associated to it.
In order to fix this, remove the orderID flag from the order request. FOM will assign a unique orderID automatically.
Both orderID and orderRef should both be unique.
Also note that the orderID flag in the request is not required as OM-LR will assign a unique orderID automatically and associate it to the orderRef.
If you are hitting this issue, please check if both orderID and OrderRef are present in the order request and if so, try again only with OrderRef.