Bugs item #850013, was opened at 2003-11-27 04:08 Message generated for change (Settings changed) made by loubyansky You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=850013&group_id=22866
Category: JBossCMP Group: v3.2 Status: Open >Resolution: Accepted Priority: 7 Submitted By: Stephen Coy (scoy) >Assigned to: Alexey Loubyansky (loubyansky) Summary: EJB/JBoss-QL compiler has been broken Initial Comment: The EJB/JBoss-QL compiler appears to have broken sometime since 3.2.0. We have some entity beans arranged with the following relationships: WorklistDefinition <--- Role *<-- UserRoleSeq -->* User where <--- is a unidirectional 0..1:1 relationship *<-- are unidirectional 1:0..N relationships We have a finder that returns a collection of all the WorklistDefinition entities associated with a particular User: This is the entity declaration in ejb-jar.xml: <entity > <description></description> <ejb-name>WorklistDefinition</ejb-name> ... <query> <description><![CDATA[]]></description> <query-method> <method-name>ejbSelectUserLists</method-name> <method-params> <method-param>java.lang.String</method-param> </method-params> </query-method> <result-type-mapping>Local</result-type-mapping> <ejb-ql> <![CDATA[SELECT DISTINCT rs.role.worklist FROM User AS u, IN (u.userRoleSeqs) AS rs WHERE rs.role.worklist IS NOT NULL AND u.loginId = ?1]]> </ejb-ql> </query> ... </entity> and the corresponding fragemnt from jbosscmp-jdbc.xml: <entity> <ejb-name>WorklistDefinition</ejb-name> ... <query> <query-method> <method-name>ejbSelectUserLists</method-name> <method-params> <method-param>java.lang.String</method-param> </method-params> </query-method> <jboss-ql> <![CDATA[SELECT DISTINCT rs.role.worklist FROM User AS u, IN (u.userRoleSeqs) AS rs WHERE rs.role.worklist IS NOT NULL AND u.loginId = ?1 ORDER BY rs.role.worklist.precedence ASC]]> </jboss-ql> <read-ahead> <strategy>on-find</strategy> <page-size>16</page-size> </read-ahead> </query> ... </entity> This should generate SQL something like: SELECT DISTINCT t0_rs_role_worklist.id, t0_rs_role_worklist.id, t0_rs_role_worklist.displayName, t0_rs_role_worklist.precedence, t0_rs_role_worklist.ascendingSort, t0_rs_role_worklist.linkName, t0_rs_role_worklist.defaultFormName, t0_rs_role_worklist.ownerAccessType, t0_rs_role_worklist.searchPredicate, t0_rs_role_worklist.progress, t0_rs_role_worklist.acceptance, t0_rs_role_worklist.dateConstraintField, t0_rs_role_worklist.dateConstraintType, t0_rs_role_worklist.sortColumnId, t0_rs_role_worklist.transitReviewId, t0_rs_role_worklist.precedence FROM ROLES t1_rs_role, USERS t2_u, USER_ROLES_SEQ t4_rs, WORKLISTDEF t0_rs_role_worklist WHERE t1_rs_role.worklistid is not null AND t4_rs.roleid=t1_rs_role.id AND t1_rs_role.worklistid=t0_rs_role_worklist.id AND t2_u.loginid=? AND t2_u.loginid=t4_rs.owneruser ORDER BY t0_rs_role_worklist.precedence ASC but instead generates: SELECT DISTINCT t0_rs_role_worklist.id, t0_rs_role_worklist.id, t0_rs_role_worklist.displayName, t0_rs_role_worklist.precedence, t0_rs_role_worklist.ascendingSort, t0_rs_role_worklist.linkName, t0_rs_role_worklist.defaultFormName, t0_rs_role_worklist.ownerAccessType, t0_rs_role_worklist.searchPredicate, t0_rs_role_worklist.progress, t0_rs_role_worklist.acceptance, t0_rs_role_worklist.dateConstraintField, t0_rs_role_worklist.dateConstraintType, t0_rs_role_worklist.sortColumnId, t0_rs_role_worklist.transitReviewId, t0_rs_role_worklist.precedence FROM USERS t2_u, USER_ROLES_SEQ t4_rs, ROLES t1_rs_role, WORKLISTDEF t0_rs_role_worklist WHERE ((t1_rs_role.worklistId IS NOT NULL AND t1_rs_role.worklistId=t1_rs_role.id)) AND t4_rs.roleid=t1_rs_role.id AND t1_rs_role.worklistId=t0_rs_role_worklist.id AND t2_u.loginId = ? AND t2_u.loginId=t4_rs.owneruser ORDER BY t0_rs_role_worklist.precedence ASC The problem seems to be in the parenthesised portion of the WHERE clause, where it is trying to compare the worklist fk of the role against the role's pk for some reason. In this case the query fails because the worklistid is a NUMBER and the role id is a VARCHAR, but clearly the query is broken in a more fundamental way. This code is working in JBoss 3.0.8, and I'm pretty sure that it was working in earlier versions of 3.2 (six months ago or so). FWIW, I'm running: java version "1.4.1_01" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-99) Java HotSpot(TM) Client VM (build 1.4.1_01-27, mixed mode) under MacOS X 10.3.1 and JBoss Branch_3_2 as of an hour or so ago. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=850013&group_id=22866 ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ JBoss-Development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development