cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ksenia Khailenko (JIRA)" <>
Subject [jira] Commented: (CAY-1484) Flattened attribute queries are incorrectly generated
Date Fri, 24 Sep 2010 17:09:35 GMT


Ksenia Khailenko commented on CAY-1484:

Really, in described situation(using datamap of the project attached), the sql string is generated
new SelectQuery(L2table.class) produces:
SELECT t1.l3val, t1.l2pk, t0.l2value, t0.l3fk, t0.l2pk FROM l2table t0 JOIN l3table t1 ON
(t0.l3fk = t1.l3pk)

and t1.l2pk is used instead of t1.l2fk
I've debugged this query evaluation and discovered that this column is generated in such a
way because in org.apache.cayenne.access.trans.SelectTranslator.appendQueryColumns[313].PropertyVisitor.visitRelationship[366]
there is considered the relationship between table1 and table2, but not between table2 and
table3 as expected. So, it's strange why it uses incorrect alias and skips the join between
table2 and table1 in from section. need to investigate deeper. seems like incorrectly defined
relationship is used.

Misha, could you be so kind to name the entities more intuitive understandable then they are
now?) it's very hard to understand what it it incorrect in the relationship if we are using
just numbered names. And as for the attached project - could you make this project like it
is described in there's used
inMemory db and maven, so we would be not dependent on libraries and schema. 

Regards, Ksenia

> Flattened attribute queries are incorrectly generated
> -----------------------------------------------------
>                 Key: CAY-1484
>                 URL:
>             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:
>   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.

View raw message