cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ksenia Khailenko (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAY-1484) Flattened attribute queries are incorrectly generated
Date Sat, 25 Sep 2010 10:45:34 GMT

    [ https://issues.apache.org/jira/browse/CAY-1484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12914806#action_12914806
] 

Ksenia Khailenko commented on CAY-1484:
---------------------------------------

Ok, I've solved the problem in bugdemo project by changing the flattened attribute Album.ArtistName
name from "ArtistName" to "artistName" and regenerating the classes(btw, the regeneration
of classes also solved the NPE problem with the commented line in Main - you've changed the
Artist.albumsRel to Artist.albumRel in datamap, but forgotten to regenerate Artist java class).

But such a solution didn't explain the error in CayenneBugDemo - the flattened attribute l3value
starts with lowercase letter. I've played with naming of attributes and discovered, that for
the correct query generation name of the flattened attribute must match the name of the referring
db attribute: "artistName" in case of bugdemo and "l3val" in case of CayenneBugDemo.

So, this is the bug and SelectTranslator should be checked in place where it generates aliases
and columns for the flattened attributes(It seems like the relationships are added basing
on the incorrect attribute name )

> Flattened attribute queries are incorrectly generated
> -----------------------------------------------------
>
>                 Key: CAY-1484
>                 URL: https://issues.apache.org/jira/browse/CAY-1484
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 3.0.1
>         Environment: Gentoo linux
> MySQL 5.1
> java version "1.6.0_20"
> Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
> Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)
>            Reporter: Misha Doronin
>         Attachments: bugdemo_maven_derby.zip, bugdemo_maven_derby_nobug.zip, CayenneBugDemo.zip
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Attached eclipse project demonstrating issue, including cayenne model
> When creating database structure like:
> table1
>   t1key
>   t1value
>   t2keyref
> table2
>   t2key
>   t2value
>   t3keyref
> table3
>   t3key
>   t3value
> and cayenne model with flattened attribute table3.t3value in table2
> it produces incorrect join query to table2 and 3:
> SELECT t1.t3value, t1.t2key, t0.t2value, t0.t3keyref, t0.t2key FROM testschema.table2
t0 JOIN testschema.table3 t1 ON (t0.t3key = t1.t3keyref) WHERE t0.t2key = ?
> Note t1.t2key, which obviously shouldn't be there and produces error.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message