I ran into the same thing, trying to use the same model for both Oracle
and PostgreSQL databases (production and development). I hacked the
Cayenne source to keep dbAttribute names lower case internally,
regardless of their case in the DataMap. It's been working well for me
but I'm not sure it would cover all cases. One possible breaking case
might be a SelectQuery that directly specifies dbAttribute names with
the "db:" prefix.
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
> <mailto: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
> <mailto: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 : Fri Jan 27 2006 - 09:01:35 EST