Ýlgi:Re:Cache problem

From: emre.yilma..r.net
Date: Fri Feb 10 2006 - 10:53:05 EST

  • Next message: Andrus Adamchik: "Re: Ä°lgi:Re: Cache problem"

    Cayenne version : cayenne-1.2-dev-2005-10-26.tar.gz
    Type of Query :SelectQuery

    My code below:
    public static PersonelCard getPersonelCardByTranponderNo(String number,Integer
    cardNo) {
            SelectQuery query = new SelectQuery(PersonelCard.class);
            Expression qualifier = ExpressionFactory.matchExp(
                            PersonelCard.TRANSPONDER_NO_PROPERTY, number);
            query.setQualifier(qualifier);
            qualifier = ExpressionFactory.matchExp(
                            PersonelCard.BADGE_NO_PROPERTY, cardNo);
            query.andQualifier(qualifier);
            CardType cardType = CardType.getCardType(Constants.PERSONEL_CARD);
            qualifier = ExpressionFactory.matchExp(
                            PersonelCard.CARD_TYPE_REL_PROPERTY, cardType);
            query.andQualifier(qualifier);
            qualifier = ExpressionFactory.matchExp(
                            PersonelCard.ASSIGNED_PROPERTY, new Boolean(true));
            query.andQualifier(qualifier);
            query.setCachePolicy(SelectQuery.LOCAL_CACHE);
            query.setName("PersonelCardCached");
            query.setRefreshingObjects(false);
            List card = context.performQuery(query);
            return (card.size() > 0) ? (PersonelCard) card.get(0) : null;
        }

    in main method:
    PersonelCard card1 = getPersonelCardByTranponderNo("1",new Integer(1));
    PersonelCard card2 = getPersonelCardByTranponderNo("2",new Integer(2));

    card1 and card2 are returns same objects but I know they must be different
    objects.

    >
    > Kimden: Andrus Adamchik <andru..bjectstyle.org>
    > Tarih: 2006/02/10 Fri AM 10:40:48 GMT+02:00
    > Kime: cayenne-use..bjectstyle.org
    > Konu: Re: Cache problem
    >
    > This may be a bug. What type of query (SelectQuery, SQLTemplate or
    > ProcedureQuery) and what version of Cayenne are you using?
    >
    > Andrus
    >
    >
    > On Feb 10, 2006, at 10:31 AM, <emre.yilma..r.net>
    > <emre.yilma..r.net> wrote:
    > > Hi,
    > >
    > > Is there any way to load the objects in dataContext and then make
    > > query in
    > > objects stored in context without connecting database each time
    > > (Local cache)?
    > > I store the objects in context but when I use the named query with
    > > local cache
    > > and setRefreshingObjects(false),cayenne returns the same object
    > > with a diffent
    > > query parametre .This probably causing from setRefreshingObjects
    > > (false) Why
    > > setRefreshingObjects(false) make the named query results same for
    > > different
    > > parameters of query. Is there any solution.
    > >
    > >
    > >
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Fri Feb 10 2006 - 10:52:32 EST