Hi Andrus,
I don't find the "query.setRefreshingRefetchedObjects(true)" metod for
SelectQuery. But I have used the
query.setRefreshingObjects(true). If you mean this, the result not changed. I
think this is a bug.Maybe I not explain the situation correctly.
Prefetched objects of PersonelCard's relational tables(PersonelRel) refreshed
correctly but local objects (badgeNo) of PersonelCard table refreshed only
first update.
This is the my code:
public static void main(String[]arg){
DbObject.setContext();
List list = getLists();
Iterator itr = list.iterator();
while(itr.hasNext()){
PersonelCard card = (PersonelCard)itr.next();
java.lang.System.err.println("getBadgeNo "+card.getBadgeNo());
java.lang.System.err.println("getRecordNo "+card.getPersonelRel().getRecordNo
());
java.lang.System.err.println("getFirstName "+card.getPersonelRel().
getPersonelIdentityRel().getFirstName());
java.lang.System.err.println("getLastName "+card.getPersonelRel().
getPersonelIdentityRel().getLastName());
}
}
}
public static List getLists() {
SelectQuery query = new SelectQuery(PersonelCard.class);
query.setRefreshingObjects(true);
Expression qualifier = ExpressionFactory.matchExp(ASSIGNED_PROPERTY, new
Boolean(true));
query.setQualifier(qualifier);
qualifier = ExpressionFactory.noMatchExp(BADGE_NO_PROPERTY, null);
query.andQualifier(qualifier);
qualifier = ExpressionFactory.noMatchExp(BADGE_NO_PROPERTY, new Integer(0));
query.andQualifier(qualifier);
qualifier = ExpressionFactory.noMatchExp(TRANSPONDER_NO_PROPERTY, null);
query.andQualifier(qualifier);
qualifier = ExpressionFactory.noMatchExp(PERSONEL_REL_PROPERTY, null);
query.andQualifier(qualifier);
qualifier = ExpressionFactory.matchExp("personelRel.deleted", new Boolean
(false));
query.andQualifier(qualifier);
query.setCachePolicy(QueryMetadata.LOCAL_CACHE_REFRESH);
query.addPrefetch("personelRel").setSemantics(
PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
query.addPrefetch("personelRel.personelIdentityRel").setSemantics(
PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
query.addPrefetch("cardValidtyRel").setSemantics(
PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
return context.performQuery(query);
}
>
> Kimden: Andrus Adamchik <andru..bjectstyle.org>
> Tarih: 2006/02/23 Thu AM 10:51:37 GMT+02:00
> Kime: cayenne-use..bjectstyle.org
> Konu: Re: Prefetched Query
>
> Regardless of the cache policy setting, you will need to do
> "query.setRefreshingRefetchedObjects(true)" to ensure that when the
> fetch is actually performed, the objects are refreshed. If you used
> to set this flag to false prior to M11, you'll need to change it.
>
> Andrus
>
>
> On Feb 23, 2006, at 10:36 AM, <emre.yilma..r.net>
> <emre.yilma..r.net> wrote:
>
> > Hi,
> >
> > I use the cayenne-1.2M11 version. When I set the prefetches with
> > QueryMetadata.
> > LOCAL_CACHE_REFRESH, prefetched data refreshed correctly but local
> > data(not
> > prefetched,attiribute on object entity class,maked query) is
> > refreshed for
> > first update and not refreshed for other updates.
> > I don't find answer of this problem. Is there any way to make
> > prefetched query
> > with local cache refresh(Refreshing all objects in the context, not
> > only
> > prefetched, for each time of calling the query).
> >
> > Thanks,
> >
> >
>
>
>
This archive was generated by hypermail 2.0.0 : Fri Feb 24 2006 - 03:33:20 EST