Details
-
Bug
-
Resolution: Done
-
Critical
-
JBossAS-3.2.6 Final
-
None
Description
SourceForge Submitter: gunterze .
JDBCEJBQLCompiler does not take care to put the right
table name in front of the LEFT JOIN phrase:
Extending the GangsterBean by finder:
<query>
<query-method>
<method-name>findMembers_leftjoin</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<jboss-ql><![CDATA[
SELECT OBJECT(g)
FROM gangster g
WHERE g.organization.name = ?1
]]>
</jboss-ql>
<read-ahead>
<strategy>on-find</strategy>
<page-size>4</page-size>
<eager-load-group>basic</eager-load-group>
<left-join cmr-field="hangout"
eager-load-group="quick info"/>
</read-ahead>
</query>
results in:
SELECT t0_g.id, t0_g.name, t0_g.nick_name,
t0_g.badness, t1_g_hangout.id, t1_g_hangout.city,
t1_g_hangout.st, t1_g_hangout.zip FROM GANGSTER t0_g,
ORGANIZATION t2_g_organization LEFT OUTER JOIN LOCATION
t1_g_hangout ON t0_g.hangout=t1_g_hangout.id WHERE
(t2_g_organization.name = ? AND
t0_g.organization=t2_g_organization.name)
0
The order of GANGSTER t0_g, ORGANIZATION
t2_g_organization is wrong. HSQL seems to be able to
intepretate the statement anyway, but other DBs (e.g.
PostgreSQL) report a SQL error.
The EJBQLToSQL92Compiler simple ignores the Left join
read ahead configuration for the cmr field:
SELECT t0_g.id, t0_g.name, t0_g.nick_name,
t0_g.badness, t0_g.cell_area, t0_g.cell_exch,
t0_g.cell_ext, t0_g.page_area, t0_g.page_exch,
t0_g.page_ext, t0_g.email, t0_g.organization,
t0_g.hangout FROM GANGSTER t0_g LEFT OUTER JOIN
ORGANIZATION t1_g_organization ON
t0_g.organization=t1_g_organization.name WHERE
t1_g_organization.name = ?