[jira] Commented: (OPENJPA-81) Bad error message when trying to query a Collection relation using dot notation
[ http://issues.apache.org/jira/browse/OPENJPA-81?page=comments#action_12449748 ] Craig Russell commented on OPENJPA-81: -- Yes, it's illegal and pending a change to the specification (which is unlikely), you should rewrite the query. Craig > Bad error message when trying to query a Collection relation using dot > notation > --- > > Key: OPENJPA-81 > URL: http://issues.apache.org/jira/browse/OPENJPA-81 > Project: OpenJPA > Issue Type: Improvement > Components: diagnostics, query > Environment: openJPA 0.9.7 > MySQL 5.0.15 >Reporter: Jakob Braeuchi >Priority: Minor > > 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.id, t0.bezeichnung FROM ekv2kategoriegruppe t0 INNER JOIN > ekv2kategorie t1 ON t0.id = 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: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (OPENJPA-81) Bad error message when trying to query a Collection relation using dot notation
[ http://issues.apache.org/jira/browse/OPENJPA-81?page=comments#action_12449747 ] Jakob Braeuchi commented on OPENJPA-81: --- i had to put the alias behind the braces to make it work with hibernate: select distinct k from KategorieGruppe k, in(k.kategorien) kat where kat.bezeichnung like ?1 > Bad error message when trying to query a Collection relation using dot > notation > --- > > Key: OPENJPA-81 > URL: http://issues.apache.org/jira/browse/OPENJPA-81 > Project: OpenJPA > Issue Type: Improvement > Components: diagnostics, query > Environment: openJPA 0.9.7 > MySQL 5.0.15 >Reporter: Jakob Braeuchi >Priority: Minor > > 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.id, t0.bezeichnung FROM ekv2kategoriegruppe t0 INNER JOIN > ekv2kategorie t1 ON t0.id = 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: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (OPENJPA-81) Bad error message when trying to query a Collection relation using dot notation
[ http://issues.apache.org/jira/browse/OPENJPA-81?page=comments#action_12449737 ] Jakob Braeuchi commented on OPENJPA-81: --- hi marc, yes KategorieGruppe.kategorien is a collection and it's supported by both toplink and hibernate. if it's illegal, i'll have to rewrite the query. thanks jakob > Bad error message when trying to query a Collection relation using dot > notation > --- > > Key: OPENJPA-81 > URL: http://issues.apache.org/jira/browse/OPENJPA-81 > Project: OpenJPA > Issue Type: Improvement > Components: diagnostics, query > Environment: openJPA 0.9.7 > MySQL 5.0.15 >Reporter: Jakob Braeuchi >Priority: Minor > > 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.id, t0.bezeichnung FROM ekv2kategoriegruppe t0 INNER JOIN > ekv2kategorie t1 ON t0.id = 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: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (OPENJPA-81) Bad error message when trying to query a Collection relation using dot notation
[ http://issues.apache.org/jira/browse/OPENJPA-81?page=comments#action_12449592 ] Marc Prud'hommeaux commented on OPENJPA-81: --- Is KategorieGruppe.kategorien a Collection? If so, then it is a violation of the spec to query it by dot notation. I'm surprised that Hibernate and Toplink would support it, since it is explicitly illegal. Specifically, section 4.4.4 of the specification says: "Path expressions can be composed from other path expressions if the original path expression evaluates to a single-valued type (not a collection) corresponding to a association-field." > Bad error message when trying to query a Collection relation using dot > notation > --- > > Key: OPENJPA-81 > URL: http://issues.apache.org/jira/browse/OPENJPA-81 > Project: OpenJPA > Issue Type: Improvement > Components: diagnostics, query > Environment: openJPA 0.9.7 > MySQL 5.0.15 >Reporter: Jakob Braeuchi >Priority: Minor > > 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.id, t0.bezeichnung FROM ekv2kategoriegruppe t0 INNER JOIN > ekv2kategorie t1 ON t0.id = 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: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (OPENJPA-81) Bad error message when trying to query a Collection relation using dot notation
[ http://issues.apache.org/jira/browse/OPENJPA-81?page=comments#action_12449585 ] Jakob Braeuchi commented on OPENJPA-81: --- is this a limitation of openJPA ? the same query runs with hibernate-entitymanager and toplink-essentials. > Bad error message when trying to query a Collection relation using dot > notation > --- > > Key: OPENJPA-81 > URL: http://issues.apache.org/jira/browse/OPENJPA-81 > Project: OpenJPA > Issue Type: Improvement > Components: diagnostics, query > Environment: openJPA 0.9.7 > MySQL 5.0.15 >Reporter: Jakob Braeuchi >Priority: Minor > > 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.id, t0.bezeichnung FROM ekv2kategoriegruppe t0 INNER JOIN > ekv2kategorie t1 ON t0.id = 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: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira