Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-1998

EJB-438 - Wrong exception thrown on optimistic locking failure due to deleted entity using hibernate.jdbc.batch_versioned_data=false

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.2.0.GA_CP07, 4.3.0.GA_CP05, 4.3.0.GA_CP06, EAP 5.0.0
    • Component/s: Hibernate
    • Labels:
      None
    • Environment:

      Entity manager v3_3_2_GA_CP / RemoveTest, hibernate.jdbc.batch_versioned_data = false

    • Affects:
      Release Notes

      Description

      The test testUpdatedAndRemove on RemoveTest is failing due to a wrong exception being thrown when using hibernate.jdbc.batch_versioned_data as false (the default option).

      When it is set as "false", the exception is processed on method AbstractEntityManagerImpl#wrapStaleStateException . On line 647 it tries to load the original entity, but it doesn't exists anymore, throwing a EntityNotFoundException.

      The suggestion is to wrap line 647 in a try/catch, to catch EntityNotFoundException and rethrow the original exception as OptimisticLockException, as it is the only case I can think of that the identifier is present, it is in the context of a optimistic locking exception and the entity is not found in the database.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                laubai Laura Bailey
                Reporter:
                juraci.costa Juraci Paixão Kröhling
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: