openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Prud'hommeaux (JIRA)" <>
Subject [jira] Commented: (OPENJPA-81) Wrong alias used when querying an attribute of a 1:n child
Date Tue, 14 Nov 2006 01:06:37 GMT
    [ ] 
Marc Prud'hommeaux commented on OPENJPA-81:

You cannot traverse a Collection relation using dots. A simple example of valid JPQL is:

   SELECT OBJECT(c) FROM Customer c, IN(c.orders) o WHERE c.status = 1

In your case, you probably want:

  select distinct k from KategorieGruppe k, in(k.kategorien rel) where rel.bezeichnung like

However, we really should have a better error than just generating invalid SQL, so I'll leave
this issue open (although I'll change the priority and category).

> Wrong alias used when querying an attribute of a 1:n child
> ----------------------------------------------------------
>                 Key: OPENJPA-81
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>         Environment: openJPA 0.9.7
> MySQL 5.0.15
>            Reporter: Jakob Braeuchi
> the query over the 1:n relationship 'katergorien' 
> em.createQuery("select distinct k from KategorieGruppe k " +
>             		"where k.kategorien.bezeichnung like ?1 " +
>             		"order by k.bezeichnung asc");
> uses a wrong alias t2 in the generated SQL:
> SELECT DISTINCT, t0.bezeichnung FROM ekv2kategoriegruppe t0 INNER JOIN ekv2kategorie
t1 ON = t1.idGruppe WHERE (t2.bezeichnung LIKE ? ESCAPE '\\') ORDER BY t0.bezeichnung
ASC [params=(String) F%]
> Unknown column 't2.bezeichnung' in 'where clause' 

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


View raw message