Return-Path: X-Original-To: apmail-cayenne-commits-archive@www.apache.org Delivered-To: apmail-cayenne-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EA58417FF9 for ; Mon, 29 Sep 2014 19:52:35 +0000 (UTC) Received: (qmail 98765 invoked by uid 500); 29 Sep 2014 19:52:35 -0000 Delivered-To: apmail-cayenne-commits-archive@cayenne.apache.org Received: (qmail 98598 invoked by uid 500); 29 Sep 2014 19:52:35 -0000 Mailing-List: contact commits-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 commits@cayenne.apache.org Received: (qmail 98467 invoked by uid 99); 29 Sep 2014 19:52:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Sep 2014 19:52:35 +0000 Date: Mon, 29 Sep 2014 19:52:35 +0000 (UTC) From: "Andrus Adamchik (JIRA)" To: commits@cayenne.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CAY-1813) Missing ObjEntity Attribute Validation with Duplicate DbEntity Columns MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAY-1813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andrus Adamchik updated CAY-1813: --------------------------------- Fix Version/s: (was: 3.1) Undefined future > Missing ObjEntity Attribute Validation with Duplicate DbEntity Columns > ---------------------------------------------------------------------- > > Key: CAY-1813 > URL: https://issues.apache.org/jira/browse/CAY-1813 > Project: Cayenne > Issue Type: Improvement > Components: Modeler > Reporter: Michael Gentry > Assignee: Michael Gentry > Fix For: 3.0.3, 3.2M2, Undefined future > > > If you have two ObjEntity attributes mapped to the same DbEntity column, this should produce a validation warning. > Real world example (from tag): > > > In this example, addressFrom was mistakenly mapped to the DRIVER_ID column with no validation warning. DRIVER_ID is a foreign key. > At runtime, trying to fault to the driver using getDriver(), this SQL was produced: > SELECT ... WHERE t0.ID = ? [bind: 1->ID:'1'] (note the quotes) > The Cayenne runtime found the first mistakenly-mapped DRIVER_ID and used it, which happened to be a String, causing the SQL to be incorrectly produced and the fault to fail. > This was difficult to track down. A validation check to make sure the DB columns aren't mapped more than once would be helpful to eliminate errors. -- This message was sent by Atlassian JIRA (v6.3.4#6332)