FAQ
Hello, (and Happy new year)
I'm new to Cayenne.
I have to use some raw SQL in a part of my application.
In WebObjects i used the EOUtilies.rawrowsforSQL method.

In Cayenne, there is the SQLTemplate to use raw SQL but it seems
that it doesn't work well on complex SQL requests.

I tried a SELECT command like :
SELECT... FROM (SELECT .... FROM (SELECT ... FROM TABLE))
and there is a problem.
The DataObject does not retrieve his ID (it's normal because it's not
possible to map it) but the DataRow seems to be correct).

Is it possible to have a collection of DataRows in an HashMap,
instead of a collection of DataObjects?

I made a SQL request so you can see what i'm saying.


SELECT DISTINCT a.idtable newidTable, idColumn FROM TABLE a

Null value for 'IDTABLE'. Snapshot: org.apache.cayenne.DataRow@b48081
[values={IDCOLUMN=86008, NEWIDTABLE=9687},
version=-9223372036854775807, replaces=-9223372036854775808]. Prefix:
null

Thanks for your help
Steve.

Search Discussions

  • Andrus Adamchik at Jan 2, 2008 at 2:50 pm
    Hi Steve,

    Looks like you need to call SQLTemplate.setFetchingDataRows(true)

    Andrus
    On Jan 2, 2008, at 4:30 PM, Steve Troudart wrote:

    Hello, (and Happy new year)
    I'm new to Cayenne.
    I have to use some raw SQL in a part of my application.
    In WebObjects i used the EOUtilies.rawrowsforSQL method.

    In Cayenne, there is the SQLTemplate to use raw SQL but it seems
    that it doesn't work well on complex SQL requests.

    I tried a SELECT command like :
    SELECT... FROM (SELECT .... FROM (SELECT ... FROM TABLE))
    and there is a problem.
    The DataObject does not retrieve his ID (it's normal because it's
    not possible to map it) but the DataRow seems to be correct).

    Is it possible to have a collection of DataRows in an HashMap,
    instead of a collection of DataObjects?

    I made a SQL request so you can see what i'm saying.


    SELECT DISTINCT a.idtable newidTable, idColumn FROM TABLE a

    Null value for 'IDTABLE'. Snapshot:
    org.apache.cayenne.DataRow@b48081[values={IDCOLUMN=86008,
    NEWIDTABLE=9687}, version=-9223372036854775807,
    replaces=-9223372036854775808]. Prefix: null

    Thanks for your help
    Steve.
  • Steve Troudart at Jan 2, 2008 at 3:03 pm
    Perfect !!!

    Thanks for your help

    Le 2 janv. 08 à 15:49, Andrus Adamchik a écrit :
    Hi Steve,

    Looks like you need to call SQLTemplate.setFetchingDataRows(true)

    Andrus
    On Jan 2, 2008, at 4:30 PM, Steve Troudart wrote:

    Hello, (and Happy new year)
    I'm new to Cayenne.
    I have to use some raw SQL in a part of my application.
    In WebObjects i used the EOUtilies.rawrowsforSQL method.

    In Cayenne, there is the SQLTemplate to use raw SQL but it seems
    that it doesn't work well on complex SQL requests.

    I tried a SELECT command like :
    SELECT... FROM (SELECT .... FROM (SELECT ... FROM TABLE))
    and there is a problem.
    The DataObject does not retrieve his ID (it's normal because it's
    not possible to map it) but the DataRow seems to be correct).

    Is it possible to have a collection of DataRows in an HashMap,
    instead of a collection of DataObjects?

    I made a SQL request so you can see what i'm saying.


    SELECT DISTINCT a.idtable newidTable, idColumn FROM TABLE a

    Null value for 'IDTABLE'. Snapshot:
    org.apache.cayenne.DataRow@b48081[values={IDCOLUMN=86008,
    NEWIDTABLE=9687}, version=-9223372036854775807,
    replaces=-9223372036854775808]. Prefix: null

    Thanks for your help
    Steve.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categoriescayenne
postedJan 2, '08 at 2:30p
activeJan 2, '08 at 3:03p
posts3
users2
websitecayenne.apache.org

2 users in discussion

Steve Troudart: 2 posts Andrus Adamchik: 1 post

People

Translate

site design / logo © 2022 Grokbase