Hi Guys,

There was a thread back in July 09
(http://mail-archives.apache.org/mod_mbox/cayenne-user/200910.mbox/%[email protected]%3E)
in relation to hollow objects throwing a FaultFailureException. It
appears that the solution was to invalidated the parent object before
trying to use the one to one relationships of that object. I'm trying
to do this in a very simple environment and it appears that the
solution is not working.

Basically what I have is a ScheduledTask object which has a taskId
field which I have to set manually (usually a UUID). There is also the
scheduling system (Quartz) which is responsible for scheduling the
tasks using it's own set of tables. The Quartz database is also mapped
in my Cayenne Data Map. There is a one to one relationship from the
ScheduledTask to QuartzJobDetails via the taskId field.

I have a service class which is responsible for scheduling the task
which looks something like:

ScheduledTask task = this.scheduledTaskDao.createObject();
String taskId = UUID.randomUUID().toString();
task.setTaskId(taskId);
scheduledTaskDao.commit();

JobDetail job = new JobDetail(taskId, "test_group", TestJob.class);
SimpleTrigger trigger = new SimpleTrigger(taskId, startTime);
qScheduler.scheduleJob(job, trigger);

scheduledTaskDao.clearCache(Collections.singletonList(task))
//basically does ObjectContext.invalidateObjects()
return task;

Ignoring for a moment the fact that this is done in two different
transactions, when I call task.getQuartzJobDetails(), I get back a
hollow object QuartzJobDetails and when I try to access any fields
within this object I  get:

org.apache.cayenne.FaultFailureException: [v.3.0.1 Sep 06 2010
15:09:38] Error resolving fault for ObjectId:
<ObjectId:QuartzJobDetails,
JOB_NAME=730c2cbb-a994-4f0b-a251-da49d94be9ae> and state (hollow).
Possible cause - matching row is missing from the database.

I know for a fact that the row exists in the database and I can
actually run a Cayenne SelectQuery which easily finds the
QuartzJobDetails with ID 730c2cbb-a994-4f0b-a251-da49d94be9ae but my
task can never resolve this object correctly.

Can anyone give me any assistance?

Thank you

Gary

Reply via email to