2 Replies Latest reply on Sep 30, 2008 4:31 PM by Greybird-Oracle

    DPL: EvolveReader invoke when not evolving??

      Hi all,

      I'm not totally certain about what is going on here. I have an entity type called "Item" that has a couple Strings and ints, a composite key type that is an Integer and a Long, and an array of bytes (which just so happens to store the serialized representation of a HashMap, but this is intentionally opaque to JE). One of the ints in the Item identifies the item as a particular type (again, this is intentionally opaque to JE). When I pull out Items of type A, I have no trouble instantiating and using them. However, if I try to pull out any Item of type B, I get the following:

      Caused by: java.lang.NullPointerException
      at com.sleepycat.persist.impl.ComplexFormat.newInstance(ComplexFormat.java:478)
      at com.sleepycat.persist.impl.ComplexFormat$EvolveReader.newInstance(ComplexFormat.java:2003)
      at com.sleepycat.persist.impl.PersistEntityBinding.readEntity(PersistEntityBinding.java:88)
      at com.sleepycat.persist.impl.PersistEntityBinding.entryToObject(PersistEntityBinding.java:60)
      at com.sleepycat.persist.PrimaryIndex.get(PrimaryIndex.java:518
      ... (my code the rest of the way up) ...

      It looks like it is trying to invoke the EvolveReader in a situation where the entity class didn't actually change. Either that, or there is some change that I can't figure out that isn't causing this failure for Items with type A but is for Items with type B.

      I guess what I'm looking for is any thoughts you have about why this could fail for some instances of an Entity class and not for others of the same Entity type.

      If we start fresh with a new database and populate it, we don't get this behavior. But like I said, I'm unaware of any change to the Entity class in question (and Mercurial backs me up on this one).

        • 1. Re: DPL: EvolveReader invoke when not evolving??
          Jeff, I sent you an email on this. OTN was briefly down.
          • 2. Re: DPL: EvolveReader invoke when not evolving??

            Thanks for helping us to diagnose this problem. As I mentioned in email, the workaround for this problem is to call EntityModel.registerClass for each entity subclass in your program. For example:
            // MyEntity is an @Entity class, while MyEntitySubclass is a @Persistent class that
            // extends MyEntity.
            StoreConfig storeConfig = new StoreConfig();
            // configure the store as usual
            EntityModel model = new AnnotationModel();
            model.registerClass(MyEntitySubclass.class); // register all entity subclasses
            EntityStore store = new EntityStore(..., storeConfig);
            I strongly recommend that all users of JE 3.3.71 or earlier, who define entity subclasses, perform this workaround to guard against the problem.

            The problem has been fixed in JE 3.3.72 and greater. We won't be pushing this release to our servers until further changes warrant a new public release. If anyone would like a copy of this release before then, please send me email -- mark.hayes at the obvious .com.

            Thanks again Jeff,