2 Replies Latest reply on Jul 20, 2009 11:02 PM by Greybird-Oracle

    References to entities are not allowed

      I have a couple classes defined like this

      public final class Record {
      @PrimaryKey(sequence = "ID")
      private long id;

      private final Map<String, Result> results;

      public final class Result {
      private final Record record;

      and when I try and write a record to the primary index I get the following exception.

      Caused by: java.lang.IllegalArgumentException: References to entities are not allowed: data.Record
           at com.sleepycat.persist.impl.RecordOutput.writeObject(RecordOutput.java:94)
           at com.sleepycat.persist.impl.ReflectionAccessor$ObjectAccess.write(ReflectionAccessor.java:369)
           at com.sleepycat.persist.impl.ReflectionAccessor.writeNonKeyFields(ReflectionAccessor.java:249)
           at com.sleepycat.persist.impl.ComplexFormat.writeObject(ComplexFormat.java:517)

      The Record referenced in the Result is always the same Record as the one being written. I see the rational for the restriction for not allowing references to other entities but why not the same entity already being serialized?


        • 1. Re: References to entities are not allowed
          Hi Trevor,

          There is no reason we could not support this, and in fact we have it on our enhancement list for a future release. We'll keep your request in mind when prioritizing.

          • 2. Re: References to entities are not allowed
            For future reference, the ticket # for this enhancement is #17525.