Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2453

Manually ID'd Versioned Entities are not Optimistically Locked

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.2
    • Component/s: Write Operations
    • Labels:
      None

      For Entities that have non DB-Generated IDs, "Saves" to the DB are not optimistically locked. For example, it is possible to have two Versioned Entities with the same primary key and null versions and one will overwrite the other. This is undesirable when primary keys are meaningful and meaningful data is associated with the Entity.

      This behavior is exposed by the following test:

      {{
      @Test(expected = ConcurrentModificationException.class)
      public void testManuallyVersionedConcurrentModification()

      { final String id = UUID.randomUUID().toString(); final ManuallyVersionedEntity entity1 = new ManuallyVersionedEntity(); final ManuallyVersionedEntity entity2 = new ManuallyVersionedEntity(); entity1.setId(id); entity2.setId(id); getDs().save(entity1); getDs().save(entity2); }

      }}

            Assignee:
            Unassigned Unassigned
            Reporter:
            Sage-Pierce Sage M Pierce
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: