Re: SelectQuery and table that is synonym

From: laila paganelli (laila.paganell..mail.com)
Date: Thu Jul 07 2005 - 12:59:39 EDT

  • Next message: Andrus Adamchik: "Re: SelectQuery and table that is synonym"

    Andrus,

    I have create some test and I have discovered this strange result

    TEST 1
    ----------------------------
    query = new SQLTemplate(RawNewsLanguage.class, "SELECT t0.NOME,
    t0.ID_LNG FROM RAWNWSLNG_LAILA t0 WHERE t0.NOME = 'english'", true);
    query.setFetchingDataRows(true);

    Returns a wrong result like this

    org.objectstyle.cayenne.DataRo..6484c[version=-9223372036854775807,
    replaces=-9223372036854775808,
    values={ID_LNG=-0.00000000000000000000000000000000000000000000000000000000000000000000000281474074640242,
    NOME=ç}]

    TEST 2
    ------------------------------
    query = new SQLTemplate(RawNewsLanguage.class, "SELECT t0.ID_LNG,
    t0.NOME FROM RAWNWSLNG_LAILA t0 WHERE t0.NOME = 'english'", true);
    query.setFetchingDataRows(true);

    Returns a right result like this
    org.objectstyle.cayenne.DataRo..306ad[version=-9223372036854775806,
    replaces=-9223372036854775808, values={ID_LNG=20, NOME=english}]

    The only difference between queries above is the order of selected columns.
    When I try to read a RawNewLanguage object with
        new SelectQuery(RawNewsLanguage.class, Expression.fromString("nome
    = 'english'"));
    cayenne generate the first query and gets wrong result.

    What do you think?

    Laila

    On 7/7/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
    > Laila,
    >
    > I am replying via cayenne-user - this discussion is a better fit for
    > the user list.
    >
    > I really can't think of a reason for such behavior, so how about
    > trying a few things to debug the JDBC layer. Start by turning on data
    > rows fetch and check for differences in values (and keys!) in the
    > returned data row maps:
    >
    > query.setFetchingDataRows(true);
    >
    > This may give some hints...
    >
    > Andrus
    >
    >
    > On Jul 6, 2005, at 2:28 PM, laila paganelli wrote:
    >
    > > Hi,
    > >
    > > I'm trying to run a SelectQuery on a table that is a synonym of a
    > > remote table.
    > > I'm using oracle 10.1.0.4 and cayenne 1.2M4 jars.
    > >
    > > dataContext = DataContext.createDataContext(false);
    > > expression = Expression.fromString("name = 'english'");
    > > query = new SelectQuery(RawNewsLanguage.class, expression);
    > > result = (RawNewsLanguage)dataContext.performQuery(query).get(0);
    > >
    > > The cayenne query is SELECT t0.NAME, t0.ID_LNG FROM RAWNWSLNG t0 WHERE
    > > t0.NAME = ? [bind: 'english']
    > >
    > > If I run this query on a database with original RAWNWSLNG table, the
    > > result is correct
    > >
    > > {[ name => english
    > > ]<oid: com.extrapola.scooter.dataModel.RawNewsLanguage: <ID_LNG:
    > > 20>; state: committed>}
    > >
    > >
    > > But if I run the query on a database with RAWNWSLNG like synonym, I
    > > have a strange result
    > >
    > > {[ name => ç
    > > ]<oid: com.extrapola.scooter.dataModel.RawNewsLanguage: <ID_LNG: 0>;
    > > state: committed>}
    > >
    > > Where is the problem?
    > > How I can run my application on tables that are synonyms?
    > >
    > > Thanks,
    > > Laila
    > >
    > >
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Jul 07 2005 - 12:59:41 EDT