Return-Path: X-Original-To: apmail-cayenne-dev-archive@www.apache.org Delivered-To: apmail-cayenne-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2B6E217D44 for ; Mon, 15 Jun 2015 15:16:03 +0000 (UTC) Received: (qmail 32359 invoked by uid 500); 15 Jun 2015 15:16:03 -0000 Delivered-To: apmail-cayenne-dev-archive@cayenne.apache.org Received: (qmail 32337 invoked by uid 500); 15 Jun 2015 15:16:03 -0000 Mailing-List: contact dev-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list dev@cayenne.apache.org Received: (qmail 32326 invoked by uid 99); 15 Jun 2015 15:16:02 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jun 2015 15:16:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 63122182811 for ; Mon, 15 Jun 2015 15:16:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1 X-Spam-Level: * X-Spam-Status: No, score=1 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id n1VtsqR7sw2H for ; Mon, 15 Jun 2015 15:16:01 +0000 (UTC) Received: from smtp4.objectstyle.com (smtp4.objectstyle.com [23.253.156.183]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTP id 2251742989 for ; Mon, 15 Jun 2015 15:16:01 +0000 (UTC) Received: from [192.168.1.62] (unknown [212.98.191.4]) by smtp4.objectstyle.com (Postfix) with ESMTPSA id DBB79CC2ED for ; Mon, 15 Jun 2015 15:15:52 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Subject: Re: Case-sensitivity problems with columns (DbAttributes) From: Andrus Adamchik In-Reply-To: Date: Mon, 15 Jun 2015 18:15:52 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: dev@cayenne.apache.org X-Mailer: Apple Mail (2.2098) 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: >=20 > I've run into problems a few times caused by case-mismatch issues with > columns (DbAttributes). >=20 > 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. >=20 > What do you think about changing some of this behavior? >=20 > Like forcing or providing a switch to ensure DbAttribute names are > lowercase? >=20 > 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? >=20 > John