Thread: DPL: EvolveReader invoke when not evolving??

This question is not answered. Helpful answers available: 5. Correct answers available: 1.


Permlink Replies: 2 - Pages: 1 - Last Post: Sep 30, 2008 9:31 AM Last Post By: greybird
jhalex

Posts: 17
Registered: 11/09/07
DPL: EvolveReader invoke when not evolving??
Posted: Sep 10, 2008 2:52 PM
 
Click to report abuse...   Click to reply to this thread Reply
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).

Thanks!
Jeff
greybird

Posts: 1,296
Registered: 07/13/06
Re: DPL: EvolveReader invoke when not evolving??
Posted: Sep 10, 2008 3:59 PM   in response to: jhalex in response to: jhalex
 
Click to report abuse...   Click to reply to this thread Reply
Jeff, I sent you an email on this. OTN was briefly down.
--mark
greybird

Posts: 1,296
Registered: 07/13/06
Re: DPL: EvolveReader invoke when not evolving??
Posted: Sep 30, 2008 9:31 AM   in response to: greybird in response to: greybird
 
Click to report abuse...   Click to reply to this thread Reply
Jeff,

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
storeConfig.setModel(model);
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,
--mark
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums