1 Reply Latest reply: Apr 17, 2013 8:36 AM by user780404 RSS

    BDB0088 DB_SECONDARY_BAD: Secondary index inconsistent with primary

    1003230
      Hello,
      I am a bit new to Berkeley DB so please be indulgent.
      I am using Berkeley DB 5.3.21. I am using the Java interface.
      I have a entity class EntityClass.
      public class EntityClass {
      // Primary key is pKey
      @PrimaryKey
      private DeweyString dewey;

      // Secondary key is the sKey
      @SecondaryKey(relate=MANY_TO_ONE)
      private String nodeName;
      ...
      }

      @Persistent
      class DeweyString implements Comparable<DeweyString> {

      @KeyField(1)
      String value;

      DeweyString(String value) { this.value = value; }

      private DeweyString() {}

      public int compareTo(DeweyString o) {
      ...     
      }
      }
      The DeweyString class implements the Comparable interface. Now I get the secondaryKey, and use the secondaryKey.subIndex(tagname).entities() then I iterator the EntityCursor, but bdb throws exception. the errior is "EntityStore-bdb.EntityClass: BDB0088 DB_SECONDARY_BAD: Secondary index inconsistent with primary".

      Thanks for your advices.

      Regards,

      Hal.