cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff de Vries <jdevr...@pfrog.com>
Subject Re: Caching problem?
Date Fri, 19 May 2006 22:05:00 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
I get the following compile error (I'm using Cayenne 1.2):<br>
&nbsp; The method performQuery(Query) in the type DataContext is not
applicable for the arguments (SelectQuery, boolean)<br>
<br>
I tried to find something equivalent for Cayenne 1.2 but didn't
recognize anything.<br>
<br>
<br>
Gentry, Michael (Contractor) wrote:
<blockquote
 cite="mid110DED9F5106CC47A186602C0DD3938201168A37@EXVF.fanniemae.com"
 type="cite">
  <pre wrap="">Could you try:

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

And see if it works better?

Thanks,

/dev/mrg


-----Original Message-----
From: Jeff de Vries [<a class="moz-txt-link-freetext" href="mailto:jdevries@pfrog.com">mailto:jdevries@pfrog.com</a>]

Sent: Friday, May 19, 2006 12:18 PM
To: <a class="moz-txt-link-abbreviated" href="mailto:cayenne-user@incubator.apache.org">cayenne-user@incubator.apache.org</a>
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
person
	 */
	protected static List findFor(Person person, boolean
include_hidden,  
Class alert_subclass) {
		DataContext dc = DataContext.getThreadDataContext();
		SelectQuery query = new SelectQuery(alert_subclass);
	
query.setQualifier(ExpressionFactory.matchExp("toReceiver", person));
		query.andQualifier(ExpressionFactory.matchExp("deleted",
new Boolean 
(false)));
		if (!include_hidden)
	
query.andQualifier(ExpressionFactory.matchExp("hidden",new Boolean 
(false)));
		query.addOrdering("createDate",false);
		List result = dc.performQuery(query);
		return result;
	}

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

  </pre>
  <blockquote type="cite">
    <pre wrap="">Jeff, could you post the code where you are doing the second query?

Thanks!

/dev/mrg


-----Original Message-----
From: Jeff de Vries [<a class="moz-txt-link-freetext" href="mailto:jdevries@pfrog.com">mailto:jdevries@pfrog.com</a>]
Sent: Friday, May 19, 2006 12:09 AM
To: <a class="moz-txt-link-abbreviated" href="mailto:cayenne-user@incubator.apache.org">cayenne-user@incubator.apache.org</a>
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

    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
</body>
</html>

Mime
View raw message