FAQ
Hi,

Some paginated mechanisms are based on a persistence layer to be able to
retrieve records for a range of primary keys.

I know it is possible to insert the primary key field in the definition
but then I'm also required to populate it
when I create a record. I'm using a sequence generator to determine the
key value of a new record.

So my question is: without having to insert the key field in the
definition, is it possible to query the table
by primary key range, and if yes, how?

tx

Hans Pikkemaat

Search Discussions

  • Andrey Razumovsky at Dec 17, 2009 at 1:52 pm
    If you're using SelectQuery, Expression.inDbExp() is for you to go. See
    http://cayenne.apache.org/doc/path-expressions.html

    2009/12/17 Hans Pikkemaat <h.pikkemaat@tsi-solutions.nl>
    Hi,

    Some paginated mechanisms are based on a persistence layer to be able to
    retrieve records for a range of primary keys.

    I know it is possible to insert the primary key field in the definition but
    then I'm also required to populate it
    when I create a record. I'm using a sequence generator to determine the key
    value of a new record.

    So my question is: without having to insert the key field in the
    definition, is it possible to query the table
    by primary key range, and if yes, how?

    tx

    Hans Pikkemaat

    --
    Andrey
  • Hans Pikkemaat at Dec 17, 2009 at 2:36 pm
    Hi,

    I guess this produces the 'IN' operator.
    This would mean I need to produce all the key values in the range I want
    to retrieve?

    Is there not a betweenDbExp?

    tx

    Hans

    Andrey Razumovsky wrote:
    If you're using SelectQuery, Expression.inDbExp() is for you to go. See
    http://cayenne.apache.org/doc/path-expressions.html

    2009/12/17 Hans Pikkemaat <h.pikkemaat@tsi-solutions.nl>

    Hi,

    Some paginated mechanisms are based on a persistence layer to be able to
    retrieve records for a range of primary keys.

    I know it is possible to insert the primary key field in the definition but
    then I'm also required to populate it
    when I create a record. I'm using a sequence generator to determine the key
    value of a new record.

    So my question is: without having to insert the key field in the
    definition, is it possible to query the table
    by primary key range, and if yes, how?

    tx

    Hans Pikkemaat

  • Andrey Razumovsky at Dec 17, 2009 at 2:39 pm
    Yeah, for range you'll need betweenDbExp, I just got mistreated with
    analogue to paginated queries, which use in

    2009/12/17 Hans Pikkemaat <h.pikkemaat@tsi-solutions.nl>
    Hi,

    I guess this produces the 'IN' operator.
    This would mean I need to produce all the key values in the range I want to
    retrieve?

    Is there not a betweenDbExp?

    tx

    Hans


    Andrey Razumovsky wrote:
    If you're using SelectQuery, Expression.inDbExp() is for you to go. See
    http://cayenne.apache.org/doc/path-expressions.html

    2009/12/17 Hans Pikkemaat <h.pikkemaat@tsi-solutions.nl>


    Hi,

    Some paginated mechanisms are based on a persistence layer to be able to
    retrieve records for a range of primary keys.

    I know it is possible to insert the primary key field in the definition
    but
    then I'm also required to populate it
    when I create a record. I'm using a sequence generator to determine the
    key
    value of a new record.

    So my question is: without having to insert the key field in the
    definition, is it possible to query the table
    by primary key range, and if yes, how?

    tx

    Hans Pikkemaat




    --
    Andrey
  • Hans Pikkemaat at Dec 17, 2009 at 2:46 pm
    but the ExpressionFactory doesnt have betweenDbExp.

    I'm using version 2 btw

    Andrey Razumovsky wrote:
    Yeah, for range you'll need betweenDbExp, I just got mistreated with
    analogue to paginated queries, which use in

    2009/12/17 Hans Pikkemaat <h.pikkemaat@tsi-solutions.nl>

    Hi,

    I guess this produces the 'IN' operator.
    This would mean I need to produce all the key values in the range I want to
    retrieve?

    Is there not a betweenDbExp?

    tx

    Hans


    Andrey Razumovsky wrote:

    If you're using SelectQuery, Expression.inDbExp() is for you to go. See
    http://cayenne.apache.org/doc/path-expressions.html

    2009/12/17 Hans Pikkemaat <h.pikkemaat@tsi-solutions.nl>



    Hi,

    Some paginated mechanisms are based on a persistence layer to be able to
    retrieve records for a range of primary keys.

    I know it is possible to insert the primary key field in the definition
    but
    then I'm also required to populate it
    when I create a record. I'm using a sequence generator to determine the
    key
    value of a new record.

    So my question is: without having to insert the key field in the
    definition, is it possible to query the table
    by primary key range, and if yes, how?

    tx

    Hans Pikkemaat



  • Andrey Razumovsky at Dec 17, 2009 at 2:50 pm
    It has since 3.0. It's already in beta (and RC1 will likely be this year),
    so I advice you to switch.
    Otherwise, try

    Expression exp = new ASTBetween(new ASTDbPath(pathSpec), value1, value2);

    (not sure this is complatible with 2.0)

    2009/12/17 Hans Pikkemaat <h.pikkemaat@tsi-solutions.nl>
    but the ExpressionFactory doesnt have betweenDbExp.

    I'm using version 2 btw


    Andrey Razumovsky wrote:
    Yeah, for range you'll need betweenDbExp, I just got mistreated with
    analogue to paginated queries, which use in

    2009/12/17 Hans Pikkemaat <h.pikkemaat@tsi-solutions.nl>


    Hi,

    I guess this produces the 'IN' operator.
    This would mean I need to produce all the key values in the range I want
    to
    retrieve?

    Is there not a betweenDbExp?

    tx

    Hans


    Andrey Razumovsky wrote:


    If you're using SelectQuery, Expression.inDbExp() is for you to go. See
    http://cayenne.apache.org/doc/path-expressions.html

    2009/12/17 Hans Pikkemaat <h.pikkemaat@tsi-solutions.nl>




    Hi,

    Some paginated mechanisms are based on a persistence layer to be able
    to
    retrieve records for a range of primary keys.

    I know it is possible to insert the primary key field in the definition
    but
    then I'm also required to populate it
    when I create a record. I'm using a sequence generator to determine the
    key
    value of a new record.

    So my question is: without having to insert the key field in the
    definition, is it possible to query the table
    by primary key range, and if yes, how?

    tx

    Hans Pikkemaat







    --
    Andrey
  • Hans Pikkemaat at Dec 17, 2009 at 3:00 pm
    Hi,

    This works like a charm.

    thanks

    Hans

    Andrey Razumovsky wrote:
    It has since 3.0. It's already in beta (and RC1 will likely be this year),
    so I advice you to switch.
    Otherwise, try

    Expression exp = new ASTBetween(new ASTDbPath(pathSpec), value1, value2);

    (not sure this is complatible with 2.0)

    2009/12/17 Hans Pikkemaat <h.pikkemaat@tsi-solutions.nl>

    but the ExpressionFactory doesnt have betweenDbExp.

    I'm using version 2 btw


    Andrey Razumovsky wrote:

    Yeah, for range you'll need betweenDbExp, I just got mistreated with
    analogue to paginated queries, which use in

    2009/12/17 Hans Pikkemaat <h.pikkemaat@tsi-solutions.nl>



    Hi,

    I guess this produces the 'IN' operator.
    This would mean I need to produce all the key values in the range I want
    to
    retrieve?

    Is there not a betweenDbExp?

    tx

    Hans


    Andrey Razumovsky wrote:



    If you're using SelectQuery, Expression.inDbExp() is for you to go. See
    http://cayenne.apache.org/doc/path-expressions.html

    2009/12/17 Hans Pikkemaat <h.pikkemaat@tsi-solutions.nl>





    Hi,

    Some paginated mechanisms are based on a persistence layer to be able
    to
    retrieve records for a range of primary keys.

    I know it is possible to insert the primary key field in the definition
    but
    then I'm also required to populate it
    when I create a record. I'm using a sequence generator to determine the
    key
    value of a new record.

    So my question is: without having to insert the key field in the
    definition, is it possible to query the table
    by primary key range, and if yes, how?

    tx

    Hans Pikkemaat





Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedDec 17, '09 at 12:47p
activeDec 17, '09 at 3:00p
posts7
users2
websitecayenne.apache.org

People

Translate

site design / logo © 2022 Grokbase