Re: open cayenne project error

From: Tomislav (tnaki..ofthome.net)
Date: Mon Mar 14 2005 - 08:39:54 EST

  • Next message: Michele Cuozzo: "just to test my new address"

    Andrus Adamchik wrote:

    >
    > On Mar 12, 2005, at 8:47 AM, tnaki..ofthome.net wrote:
    >
    >> Andrus Adamchik wrote:
    >>
    >>> Looks like you are hitting a known problem -
    >>> http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-236
    >>
    Per your recomendation, I tried using 1.2M1. I renamed all the
    obj-attributes so that the validator didn't complain about them, but I
    left the database attribute names as they were. I got the following error:

    INFO QueryLogger: +++ Connecting: SUCCESS.
    INFO QueryLogger: --- transaction started.
    INFO QueryLogger: SELECT t0.Alkohol, t0.Bakar, t0.Beta karoten,
    t0.biotin, t0.Cink, t0.Energetska vrijednost, t0.Folna kiselina,
    t0.Fosfor, t0.fruktoza, t0.glukoza, t0.jednostruko nezas#m#k#, t0.Jod,
    <<...snip...>> FROM dbo.proizvod t0 - prepared in 69 ms.
    INFO QueryLogger: *** error.
    java.sql.SQLException: Line 1: Incorrect syntax near 'm#k'.
        at
    net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:367)
        at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2606)
        at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2048)
        at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:574)
    <<...snip...>>

    Obviuosly, this query isn't going to work. When I place the attribute
    names in square brackets and manually run such a modified query ("SELECT
    t0.[Alkohol], t0.[Bakar]..."), it works. Wouldn't it be better if the
    SQL generator placed attributes in square brackets by default, or to at
    least have an option somewhere to generate "safe SQL"? Is this a
    DBMS-specific solution?
     From what I could tell, it could be done fairly easily in
    /src/cayenne/org/objectstyle/cayenne/access/trans/SelectTranslator.java,
    but I couldn't say exactly where without setting up a cayenne project
    and running through the code.

    Is this one of the problems corrected in v.1.1.1? Judging by the list of
    resolved issues on
    http://objectstyle.org/confluence/display/CAY/2005/03/13/, it doesn't
    look like it's been adressed: the closest related problem was escaping
    strings in the modeler, and that doesn't sound like it.

    Tomislav



    This archive was generated by hypermail 2.0.0 : Mon Mar 14 2005 - 08:39:59 EST