Grokbase Groups Cayenne dev June 2015
FAQ
Hi John,

IIRC you can force PostgreSQL (or any other DB really) to treat column names as case-sensitive by including them in double quotes when creating and querying the tables. In Cayenne this means setting "Quote SQL Identifiers" to "on" in the DataMap and using explicit double quotes in SQLTemplate.

Not going to help with "SELECT * FROM", but should address all other cases.
Like forcing or providing a switch to ensure DbAttribute names are
lowercase?
If the above doesn't help, you can probably decorate DataMapLoader service to conditionally convert loaded DataMap to lower case DbAttributes (if you can access DataSource and determine DB type prior to project loading), or do that in the EntityResolver after ServerRuntime startup (less clean, but same end result).

Andrus

On Jun 13, 2015, at 12:13 AM, John Huss wrote:

I've run into problems a few times caused by case-mismatch issues with
columns (DbAttributes).

The primary one being when I have SQLTemplate queries that return actual
DataObjects. If the DbAttribute is declared with mixed case (myTablePK)
then my query just returns a list of nulls because it can't find the pk
field to create an ObjectId. I'm using postgres mostly which is not
case-sensitive and returns the columns in lowercase it seems.

What do you think about changing some of this behavior?

Like forcing or providing a switch to ensure DbAttribute names are
lowercase?

Or doing more intelligent matching that ignores case as much as possible?
I.E. if there are no duplicate columns when ignoring case, then ignore case?

John

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 3 | next ›
Discussion Overview
groupdev @
categoriescayenne
postedJun 12, '15 at 9:14p
activeJun 15, '15 at 5:19p
posts3
users2
websitecayenne.apache.org

2 users in discussion

John Huss: 2 posts Andrus Adamchik: 1 post

People

Translate

site design / logo © 2021 Grokbase