Re: query problem

From: Eric Schneider (eri..entralparksoftware.com)
Date: Fri Mar 12 2004 - 10:01:56 EST

  • Next message: Michael Schuldt: "AW: query problem"

    Michael,

    I would think you could use the string expression API.

    Expression.fromString("status = $param1 and current_stock < (least_decrease
    * capacitySU)").

    Hope that helps,
    Eric

    ----- Original Message -----
    From: "Michael Schuldt" <m..scensys.de>
    To: <cayenne-use..bjectstyle.org>
    Sent: Friday, March 12, 2004 9:46 AM
    Subject: query problem

    > Hi,
    >
    > situation as follwos:
    >
    > I've got a table "tb_offer" with the follwoing fields:
    > - id (int)
    > - name (varchar)
    > - status (varchar)
    > - current_stock (double)
    > - least_decrease (double)
    > - capacitySU (int)
    >
    > Now I want to create the following SQL-Statement:
    > SELECT * FROM tb_offer WHERE status = 'on' AND current_stock <
    > (least_decrease * capacitySU);
    >
    > You see, in SQL this isn't a problem. But if I want to create this
    > Expression with Cayenne, I have to give up.
    >
    > A solution would be to use raw-sql but I have to use the resulting Objects
    > (TbOffer) for update. By using raw-sql I have to reread the Objects after
    > the first query.
    >
    > Any suggestions?
    >
    > Thx



    This archive was generated by hypermail 2.0.0 : Fri Mar 12 2004 - 10:01:31 EST