Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-7053

JPA Skip locked entities

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.12.1
    • 2.13.0
    • camel-jpa
    • None
    • Unknown

    Description

      The current implementation of the JPA endpoint is created more for using it as a queue for one JVM.

      This change performs the lock with timeout=0, causing a NOWAIT to be used where implementations support it.
      Ideally the lock should be performed using refresh() instead of lock() to prevent dirty read exceptions but Hibernate's implementation throws the wrong exception.
      https://hibernate.atlassian.net/browse/HHH-8786
      Currently OpenJPA throws the wrong exception for both lock and refresh so the test uses hibernate. See this jira:
      https://issues.apache.org/jira/browse/OPENJPA-2461

      The default lock of WRITE=OPTIMISTIC_FORCE_INCREMENT performs the lock too late and their are various jpa implementation problems (OpenJPA doesn't lock it in memory, hibernate performs the delete before the increment). In nearly every use case PESSIMISTIC_WRITE is more correct.

      Attachments

        1. skipLockedJpa.patch
          15 kB
          Chris Watts

        Activity

          People

            njiang Willem Jiang
            wattsc3 Chris Watts
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: