Re: SQLTemplate & HSQLDB question

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jan 25 2006 - 18:16:33 EST

  • Next message: Andrus Adamchik: "Re: SQLTemplate & HSQLDB question"

    I can see it in the logs:

    >> INFO QueryLogger: SELECT * FROM Contact WHERE last_name like 'l%'

    The problem is clearly with snapshot capitalization. MySQL likely
    provided lowercase column names, and HSQLDB provides uppercase. The
    only solution I see is to apply mention all result columns explicitly
    and apply #result(..) directive to all of them to build the right
    result:

    http://objectstyle.org/cayenne/userguide/fetch/sqltemplate-
    scripting.html

    You may have to do some typing here:

    SELECT #result('SPOUSE_FIRST_NAME' String 'spouse_first_name'),
    #result(...)

    Andrus

    On Jan 25, 2006, at 6:00 PM, Cris Daniluk wrote:

    > What is the query string??
    >
    > On 1/25/06, Steve Lorimer <lorimer.stev..mail.com> wrote:
    >>
    >>
    >> Hello all,
    >>
    >> I am trying to add HSQLDB support to my application using
    >> Cayenne. I'm successfully using MySQL 5 with Cayenne.
    >>
    >> Here's the code segment:
    >> SQLTemplate query2 = new SQLTemplate(Contact.class,
    >> queryString, true);
    >> people = new DataObjectList(dataContext.performQuery(query2));
    >>
    >> A couple of notes. First, this all works correctly when using
    >> MySQL as the db engine. (Yes, I've tried the latest Cayenne &
    >> Hsqldb jars). Second, if I use a SelectQuery with Hsqldb, it
    >> works fine and returns all the fields. However, I have to use
    >> SQLTemplate queries. For some reason, it seems that Cayenne is
    >> not getting the record_id data back, but this only occurs when
    >> using the SQLTemplate & Hsqldb. I would be grateful for any
    >> help. Thanks, Steve.
    >>
    >> Here's the debug info:
    >> INFO QueryLogger: --- transaction started.
    >> INFO QueryLogger: SELECT * FROM Contact WHERE last_name like 'l%'
    >> INFO QueryLogger: === returned 1 row. - took 47 ms.
    >> INFO QueryLogger: +++ transaction committed.
    >> org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2M10
    >> January 5 2006] Null value for 'record_id'. Snapshot:
    >> org.objectstyle.cayenne.DataRo..0c6cfc
    >> [version=-9223372036854775807, replaces=-9223372036854775808,
    >> values={SPOUSE_FIRST_NAME=Melissa, STATE=, HOME_CHURCH=,
    >> DENOMINATION=0, ZIPCODE=, VOLUNTEER_INTEREST=false,
    >> VOLUNTEER_AREAS=, FAX=, CONTACT_SOURCE=0, RECORD_MODIFIED_BY=Test
    >> User, DONOR_TYPE=2, MARITAL_STATUS=0, CONTACT_FLAGS=,
    >> PHOTO_DATE=null, EMAIL2=, PHONE1=, GREETING_FORMAL=Mr. & Mrs.
    >> Steve Lorimer, RECORD_LOCATION=0, RECORD_ID=0, SPOUSE_LAST_NAME=,
    >> CONTACT_DETAILS=, VOLUNTEER_COMMENTS=, ADDRESS2=, COUNTRY=,
    >> GREETING_INFORMAL=Steve & Melissa, GROUP_AFFILIATION=,
    >> DECEASED=false, ANNIVERSARY_DATE=null, VOLUNTEER_SKILLS=, EMAIL1=,
    >> SPOUSE_DECEASED=false, SPOUSE_BIRTH_DATE=null, PHONE2=,
    >> RECORD_STATE=true, ORGANIZATION_NAME=, LAST_NAME=Lorimer,
    >> RECORD_CREATION_BY=Test User, RECORD_MODIFIED_DATE=Wed Jan 25
    >> 00:00:00 EST 2006, FIRST_NAME=Steve, CITY=, ALUMNI=false,
    >> ADDRESS1=, BIRTH_DATE=Wed Jan 25 00:00:00 EST 2006,
    >> CONTACT_LISTS=, RETIRED=false, RECORD_CREATION_DATE=Wed Jan 25
    >> 00:00:00 EST 2006}]. Prefix: null
    >> at org.objectstyle.cayenne.DataRow.createObjectId
    >> (DataRow.java:238)
    >> at org.objectstyle.cayenne.DataRow.createObjectId
    >> (DataRow.java:193)
    >> at org.objectstyle.cayenne.DataRow.createObjectId
    >> (DataRow.java:167)
    >> at
    >> org.objectstyle.cayenne.access.ObjectResolver.objectFromDataRow
    >> (ObjectResolver.java:231)
    >> at
    >> org.objectstyle.cayenne.access.ObjectResolver.objectsFromDataRows
    >> (ObjectResolver.java:149)
    >> at
    >> org.objectstyle.cayenne.access.ObjectResolver.synchronizedObjectsFrom
    >> DataRows(ObjectResolver.java:128)
    >> at
    >> org.objectstyle.cayenne.access.DataContextSelectAction.getResultsAsOb
    >> jects(DataContextSelectAction.java:218)
    >> at
    >> org.objectstyle.cayenne.access.DataContextSelectAction.performQuery
    >> (DataContextSelectAction.java:181)
    >> at
    >> org.objectstyle.cayenne.access.DataContextSelectAction.performQuery
    >> (DataContextSelectAction.java:93)
    >> at org.objectstyle.cayenne.access.DataContext.performQuery
    >> (DataContext.java:1200)
    >> at
    >> org.kmbc.konnections.ui.KeyFrameController.performContactQuery
    >> (KeyFrameController.java:1540)
    >> at org.kmbc.konnections.ui.KeyFrameController.connectAction
    >> (KeyFrameController.java:871)
    >> at org.kmbc.konnections.ui.actions.LoginScreenWithStatusBar
    >> $1.actionPerformed(LoginScreenWithStatusBar.java:100)
    >



    This archive was generated by hypermail 2.0.0 : Wed Jan 25 2006 - 18:16:42 EST