1 Reply Latest reply on Jul 30, 2004 3:01 AM by aloubyansky

    ejb-ql with

    tsangcn

      Hello,

      Consider the following in ejb-jar.xml

       <query>
       <description></description>
       <query-method>
       <description>Find by activity from transition</description>
       <method-name>findByActivityTransition</method-name>
       <method-params>
       <method-param>my.ejb.ActivityLocal</method-param>
       <method-param>my.ejb.TransitionLocal</method-param>
       </method-params>
       </query-method>
       <result-type-mapping>Local</result-type-mapping>
       <ejb-ql>
       [CDATA[
       SELECT OBJECT(a)
       FROM Action a
       WHERE a.activity = ?1
       AND (a.transition IS NULL OR a.transition = ?2)
       ]]
       </ejb-ql>
       </query>
      

      I am using CMR. Transition has 0..n Action relationship. Activity has 0..n Action relationship.
      The Action table contains something like
       object_id transition_id activity_id
       1 null 2
       2 12 2
       11 16 24
      

      I expected it can return all the actions (Action EJB) where transition is null or transition equals the parameter (TransitionLocal).

      In JBoss-3.2.3, it only returns actions for transition equals the parameter. But actions for transition is null can never be returned.

      In JBoss-3.2.5 with the EJBQLToSQL92Compiler, it do returns what I expected.

      And I found that the SQL generated for the 2 are different.

      Is my ejb-ql correct?

      If not correct, how should I code it?

      If correct,
      since it seems that JBoss-3.2.5 with EJBQLToSQL92Compiler can produce what I expected, do I need to change to JBoss-3.2.5 with EJBQLToSQL92Compiler?
      Since EJBQLToSQL92Compiler seems to be a new implementation, anyone has any comment on it?

      More question. I learnt that EJBQLToSQL92Compiler can be specified in in jboss.xml or in in standardjbosscmp-jdbc.xml, elsewhere can it be specified?

      Thanks
      CN