I am back again with my inheritance love-horror story.
If you rememeber from previous chapters I am using a single table
inheritance with an abstract parent object (SessionLog) and two child
object (SessionLogApi and SessionLogWeb).

The problem is that from time to time when I restart the server I start
getting this errors:

org.apache.cayenne.CayenneRuntimeException: [v.3.1B1 May 28 2012
18:42:43] Can't extract a master key. Missing key (idSessionLog), master
ID (<ObjectId:SessionLogApi, TEMP:00000E5FC15FE9A1>)
        at
org.apache.cayenne.access.DataDomainSyncBucket$PropagatedValueFactory.create(DataDomainSyncBucket.java:311)

After a restart usually are gone and never start happening during the
life of a running server, so it seems it is some problem with the model
loading process or something like that.

I am creating the object like this:
        SessionLogApi sessionLog =
createAndRegisterNewObject(SessionLogApi.class); //This calls to newObject
        sessionLog.setSessionStart(new Date());
        sessionLog.setToDevice(device);
        sessionLog.setToUser(device.getToUser());

But the context I commit has also some more new objects and one of them
with a relationship (1 to 1) with SessionLogApi (sessionLog ID is stored
in the other entity), the funny thing is that it does not complain when
creating a SessionLogWeb in that case there are similar relationships
with the SessionLogWeb id stored in other entity in the same commit.
So it only throw errors with one of the two childs and only after some
server starts (and it continues to fail until a server restart).

I will happily send more traces to try to catch the error if you tell me
what do you need.

Ramiro Aparicio





Reply via email to