Unique-Constraint Exceptions when sending messages from a Message-Driven-Bean(MDB) into the Database

Solution Verified - Updated -

Issue

Consider the following scenario:

  • A Message-Driven-Bean (MDB) with 20 parallel instances is reading from a JMS queue
  • The payload of the message is mapped to the entity model
    using Apache Deltaspike and JBoss-Hibernate.
  • A message can either be new (a) or already exists (b). In case of (a) the new message gets inserted into the Database, else it gets merged.
  • The check regarding (a) and (b) is performed on the Dataobject (DAO) on some Custom ID extracted from the message.
  • In the Database a Unique-Constraint on the ID has been defined.

Under load the following exception occurred:


org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:109) Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (INDEX) violated at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1017) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:655)

The issue is that the exception cannot be handled and a retry is not possible.

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)- Version 6.4.0_CP08
  • Oracle 11 Database

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.