Re: limit of objects for in-memory filter?

From: Eric Schneider (eric.j.schneide..mail.com)
Date: Fri Dec 02 2005 - 16:15:09 EST

  • Next message: tibolists: "DB Schema and cayenne"

    Hmm. Not sure what the deal is. It's definitely not a typing issue
    (they're Integers).

    I guess I'll switch back to querying the db. Not such a big deal.

    Thanks!
    Eric

    On 12/2/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
    > Eric,
    >
    > No, there is no artificial limit on how many objects you can filter.
    > The only practical limit is the amount of memory. Since you already
    > have these objects in memory, this is not a problem either.
    >
    > In-memory algorithms do have some limitations though. There is a
    > particularly stupid one that came up before - Cayenne can't compare
    > different numeric types (e.g. "new Long(5)" will not be equal to "new
    > Integer(5)"). So if for instance you have a BigDecimal inside the
    > ObjectId, and compare it to an equivalent Integer, you'll get no match.
    >
    > So inspect one of the objects to see what Java type is used within
    > ObjectId map, and use the same type in comparison.
    >
    > Andrus
    >
    > On Dec 2, 2005, at 11:10 PM, Eric Schneider wrote:
    > > Sure,
    > >
    > > Expression qual = _playerExpressionForPlayer(player);
    > > qual = qual.andExp(ExpressionFactory.matchDbExp
    > > (PlayerStats.GAMETYPE_PK_COLUMN,
    > > gameType));
    > >
    > > List results = new ArrayList(_cachedPlayerStats);
    > > results = qual.filterObjects(results);
    > >
    > > ...
    > >
    > > private Expression _playerExpressionForPlayer(Player player) {
    > > Expression qual =
    > > ExpressionFactory.matchDbExp(PlayerStats.PLAYERID_PK_COLUMN,
    > > player.getPlayerId());
    > > return qual;
    > > }
    >
    >



    This archive was generated by hypermail 2.0.0 : Fri Dec 02 2005 - 16:15:10 EST