cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <>
Subject [jira] [Updated] (CAY-1813) Missing ObjEntity Attribute Validation with Duplicate DbEntity Columns
Date Fri, 03 Apr 2015 10:19:53 GMT


Andrus Adamchik updated CAY-1813:
    Fix Version/s:     (was: 4.0.M2)

> Missing ObjEntity Attribute Validation with Duplicate DbEntity Columns
> ----------------------------------------------------------------------
>                 Key: CAY-1813
>                 URL:
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Modeler
>            Reporter: Michael Gentry
>            Assignee: Michael Gentry
>             Fix For: 3.0.3, Undefined future
> If you have two ObjEntity attributes mapped to the same DbEntity column, this should
produce a validation warning.
> Real world example (from <obj-entity> tag):
>   <obj-attribute name="addressFrom" type="java.lang.String" db-attribute-path="DRIVER_ID"/>
>   <obj-attribute name="driverId" type="java.math.BigInteger" db-attribute-path="DRIVER_ID"/>
> 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

View raw message