Re: Caching problem?

From: Jeff de Vries (jdevrie..frog.com)
Date: Fri May 19 2006 - 18:05:00 EDT

  • Next message: Andrus Adamchik: "Re: Error when join table spans datamaps"

    I get the following compile error (I'm using Cayenne 1.2):
      The method performQuery(Query) in the type DataContext is not applicable for the arguments (SelectQuery, boolean)

    I tried to find something equivalent for Cayenne 1.2 but didn't recognize anything.


    Gentry, Michael (Contractor) wrote:

    Could you try:
    
    		List result = dc.performQuery(query, true);
    
    And see if it works better?
    
    Thanks,
    
    /dev/mrg
    
    
    -----Original Message-----
    From: Jeff de Vries [mailto:jdevries@pfrog.com] 
    Sent: Friday, May 19, 2006 12:18 PM
    To: cayenne-user@incubator.apache.org
    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
    	 *
    	 *..aram person
    	 *            Person to find Alerts for
    	 *..aram include_hidden
    	 *            If true, include hidden alerts as well
    	 *..aram alert_subclass
    	 *            Class of alert to search for
    	 *..eturn 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:
    
      
    Jeff, could you post the code where you are doing the second query?
    
    Thanks!
    
    /dev/mrg
    
    
    -----Original Message-----
    From: Jeff de Vries [mailto:jdevries@pfrog.com]
    Sent: Friday, May 19, 2006 12:09 AM
    To: cayenne-user@incubator.apache.org
    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
    
        
    
      



    This archive was generated by hypermail 2.0.0 : Fri May 19 2006 - 18:05:30 EDT