Hello everybody,
I have a strange problem, that is difficult to reproduce so I would
like to gather information about the cayenne internals.
In my database I have an object JOB that has ID, NAME, PRIORITY as PKs.
I have a method
getJobByID(ID, NAME) that returns the unique job without specifying the
PRIORITY PK using a SelectQuery.
The main problem is when I use the 'getJobByID(ID, NAME)' Cayenne do the
database request, but the job does not seems to be refreshed in the
cayenne cache (object graph). If I make the request using the ObjectID,
the job is refreshed. The only differences is that using the ObjectID
Cayenne specifies the PRIORITY field.
Both requests returns the same job (cause PRIORITY is never used and
always 0), but cayenne seems to not find it in his object graph.
The question is : is it possible that Cayenne does not find back this
job in his object graph because I do not specify the PRIORITY PK in my
request ? or this can be a bug ? This behavior should be strange cause
cayenne should always update the job in his graph...
I do not use any caching system.
Thanks.
Laurent Marchal.
-----
public static DailyJob getById(ObjectContext context, IDailyJobKey key) {
HashMap<String, Object> ExpressionMap = new HashMap<String,
Object>(2);
ExpressionMap.put(DailyJob.ID_PROPERTY, key.getId());
ExpressionMap.put(DailyJob.JOB_NAME_PROPERTY, key.getJobName());
Expression expr = ExpressionFactory.matchAllExp(ExpressionMap,
Expression.EQUAL_TO);
SelectQuery qGetJob = new SelectQuery(DailyJob.class, expr);
qGetJob.setFetchLimit(1);
if (job != null && job.size() > 0) {
return job.get(0);
}
return null;
}
This archive was generated by hypermail 2.0.0 : Wed Sep 09 2009 - 09:42:38 EDT