Re: SQLTemplate & HSQLDB question

From: Bruce Alspaugh (compulinklt..mail.com)
Date: Wed Feb 08 2006 - 10:47:47 EST

  • Next message: Bruce Alspaugh: "Using Cayenne with a GUI Builder"

    I'm a new user coming from the Hibernate world, so I may not understand the
    question/response below completely. In a Hibernate mapping file, you can
    surround table and column names using a single backquote: ` Hibernate will
    then translate the quote into the one most appropriate for the particular
    SQL dialect you are using. This makes the uppercase/lowercase match
    regardless of the DB you are using.

    Would it make sense to do something similar in Cayenne?

    Bruce
    ----- Original Message -----
    From: "Andrus Adamchik" <andru..bjectstyle.org>
    To: <cayenne-use..bjectstyle.org>
    Sent: Thursday, January 26, 2006 8:57 PM
    Subject: Re: SQLTemplate & HSQLDB question

    > Actually just figured a native syntax that works on HSQL, producing
    > lowercase ids - put the column alias in quotes:
    >
    > SELECT ARTIST_NAME as "artist_name" FROM ARTIST
    >
    > That's of little consolation though, as it is only marginally less
    > verbose than #result
    >
    > :-)
    >
    > Andrus
    >
    >
    > On Jan 26, 2006, at 9:39 PM, Steve Lorimer wrote:
    >
    >> Andrus,
    >> Thanks much for your help. I've still got a few quirks, and it
    >> makes me wonder if I really want support for two DB's. A feature that
    >> interfaced between jdbc & cayenne that converted table names to upper or
    >> lower case would be pretty nice. Of course, I'm not sure how many
    >> people will face the same thing I ran into.
    >>
    >> Steve
    >>
    >> On 1/26/06, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >> > Would it work if in the select string everything was UPPERCASE?
    >>
    >> No. The essence of the problem is the capitalization mismatch between
    >> the schema you defined in CayenneModeler and the default
    >> capitalization used by the target database/driver. This is not
    >> something you can control by changing SQL syntax. I.e. if you run a
    >> query "SELECT spouse_first_name FROM ..." the column in the HSQL
    >> ResultSet will still be called "SPOUSE_FIRST_NAME".
    >>
    >> You can change capitalization of the DataMap (but then there is a
    >> chance that MySQL will have the opposite problem). For now the only
    >> solution that is DB-portable is #result() directive. In the future we
    >> may add extra scripting options.
    >>
    >> Andrus
    >>
    >>
    >>
    >> On Jan 26, 2006, at 3:17 PM, Daniel Lorimer wrote:
    >> > Steve,
    >> >
    >> > If the only issue is with capatalization, you should be able to
    >> > just convert the call to uppercase before you send the query - with
    >> > a method of some kind that runs when (if database = HSQL).
    >> >
    >> > Andrus,
    >> >
    >> > Would it work if in the select string everything was UPPERCASE?
    >> >
    >> >
    >> >
    >> > On 1/25/06, Andrus Adamchik < andru..bjectstyle.org> wrote:
    >> > On Jan 25, 2006, at 6:16 PM, Andrus Adamchik wrote:
    >> >
    >> > > You may have to do some typing here:
    >> > >
    >> > > SELECT #result('SPOUSE_FIRST_NAME' String 'spouse_first_name'),
    >> > > #result(...)
    >> >
    >> >
    >> > BTW, I'd love to improve SQLTemplate usability in this area. Maybe
    >> > introduce a callback variable that can be set in the template, like
    >> > #set( $toUpperCase = "true"), so Cayenne can read it and take an
    >> > appropriate action in the backend?
    >> >
    >> > Andrus
    >> >
    >>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Wed Feb 08 2006 - 10:47:54 EST