cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gentry, Michael \(Contractor\)" <>
Subject RE: Caching problem?
Date Fri, 19 May 2006 19:18:23 GMT
Could you try:

		List result = dc.performQuery(query, true);

And see if it works better?



-----Original Message-----
From: Jeff de Vries [] 
Sent: Friday, May 19, 2006 12:18 PM
Subject: Re: Caching problem?

It's pretty straightforward.  In the following code Person is the  
parent, and Alert is the child.  There are actually many Alert  
classes (I'm using Cayenne STI), so the specific Alert class we're  
interested in is passed as a parameter.  Also, I forgot to mention  
that if we shut everything down, and then restart, we do see the  
modified status (presumably because Cayenne really had to go back to  
the database to get the data for the child list).

	 * Finds all Alerts of the given type sent to the given person
	 * @param person
	 *            Person to find Alerts for
	 * @param include_hidden
	 *            If true, include hidden alerts as well
	 * @param alert_subclass
	 *            Class of alert to search for
	 * @return List of alert objects, of given type, for the given
	protected static List findFor(Person person, boolean
Class alert_subclass) {
		DataContext dc = DataContext.getThreadDataContext();
		SelectQuery query = new SelectQuery(alert_subclass);
query.setQualifier(ExpressionFactory.matchExp("toReceiver", person));
new Boolean 
		if (!include_hidden)
query.andQualifier(ExpressionFactory.matchExp("hidden",new Boolean 
		List result = dc.performQuery(query);
		return result;

On May 19, 2006, at 6:05 AM, Gentry, Michael ((Contractor)) wrote:

> Jeff, could you post the code where you are doing the second query?
> Thanks!
> /dev/mrg
> -----Original Message-----
> From: Jeff de Vries []
> Sent: Friday, May 19, 2006 12:09 AM
> To:
> Subject: Caching problem?
> Simplified version:  I have a parent table and a child table, where  
> the
> child table has a parent_id column and a status column.  I change the
> status in one of the child records and commit the change.  Later, I  
> ask
> for the child records for the given parent record, but the child  
> record
> that I get back on which I changed the status still has the *old*  
> status
> instead of the new status.  If I look at the database, the child  
> record
> does have the new status (and in fact I can see the update and  
> commit as
> soon as I commit the child record change).
> Why is the parent still seeing the old child status?  An additional  
> note
> is that I'm not using parent.getChildArray() but rather a
> SelectQuery(Child) that matches toParent to the parent I'm interested
> in.
> (This is in Cayenne 1.2B2 using PostgreSQL 8.1)
> Thanks,
> Jeff

View raw message