Skip to Content
0
Former Member
Jan 11, 2017 at 11:29 PM

Duplicate entries created in the PaymentTransaction table with the same time stamp

119 Views

Hello Guys,

As part of our payment solution, we are creating a new instance of the payment transaction model with the cart ID and the transaction Id during the initial handshake b/w Hybris and the payment provider to render the iframe for the Customer to key in the card details.

I'm left with a weird issue in our test env which uses mysql DB where there are two entries(with same cart ID and the transaction Id) created in the payment transaction model with the same time stamp. Please note that we are checking the DB to see if an entry exists in the payment transaction table with the given card ID and transaction ID before creating a new instance.

Also FYI, in the current state there are no unique constraints enforced against any of the attributes in the payment transaction item type.

P.S : This issue is not found in my dev machine which runs on HSQLDB.

Code snippet :

if(null == getPaymentReferencfromDB(cart, transactionID){ PaymentTransactionModel transaction = (PaymentTransactionModel) this.modelService .create(PaymentTransactionModel.class); transaction.setMerchantReference(merchreference); transaction.setCode(result.getRequestTransactionID()); modelService.save(transaction); modelService.refresh(transaction); modelService.detachAll(); }

Any advise on this would be helpful.

Thanks. Suresh