2 Replies Latest reply on Jun 25, 2003 6:06 PM by srachels

    ejbSelect problem on JBoss 3.2.1

    srachels

      Hello,
      I'm trying something that seems pretty straight forward, but it doesn't seem to be working correctly on JBoss 3.2.1. Maybe someone can help figure out if I'm doing it incorrectly or if there is a problem with JBoss.

      I have an entity ejb called "Site" that has local and remote interfaces. It has a unidirectional one-to-many cmr relationship with an entity ejb called "UrlParameter". (one site to many urlParameters). UrlParameter has both local and remote interfaces.

      I want the client to be able to call a method on the Site remote interface that returns remote interfaces of all the UrlParameters associated with a site. The method is listUrlParameters(). In the Site bean class, it calls ejbSelectUrlParameters(LocalSite site) method that has the following query in the ejb-jar descriptor:


      Select related UrlParameters
      <query-method>
      <method-name>ejbSelectUrlParameters</method-name>
      <method-params>
      <method-param>pg.ejb.LocalSite</method-param>
      </method-params>
      </query-method>
      <ejb-ql>select DISTINCT OBJECT(p) from Site s, IN(s.urlParameters) p where s=?1</ejb-ql>
      <result-type-mapping>Remote</result-type-mapping>


      I do not have a jbosscmp-jdbc.xml file since it is optional. When listUrlParameters() is called, I get the following exception:

      10:54:44,885 ERROR [LogInterceptor] EJBException, causedBy:
      java.lang.NullPointerException at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:224)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:91)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCSelectorBridge.execute(JDBCSelectorBridge.java:64)
      at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invokeEntityBridgeInvocationHandler.java:96)
      at org.jboss.proxy.compiler.Runtime.invoke (Runtime.java:59)
      at pg.ejb.SiteBean$Proxy.ejbSelectUrlParameters()
      at pg.ejb.SiteBean.listUrlParameters(SiteBean.java:53)
      ...additional stacktrace omitted...

      The attach files funciton of this forum doesn't work, so if you'd like me to cut & paste additional info, let me know.

      Any ideas?

      Thanks.
      Scott

        • 1. Re: ejbSelect problem on JBoss 3.2.1
          raja05

          Just a guess, shouldnt u be equating the key of Site Bean rather than s=?1
          Shouldnt this be s.=<idcolumn_from_method_parameter)

          If that doesnt work, make the log level as DEBUG and you should be able to see the SQL thats run.

          -Raj

          • 2. Re: ejbSelect problem on JBoss 3.2.1
            srachels

            Thanks for the reply, Raj. I thought the spec allowed the where clause can compare objects as such. Also, I looked at the DEBUG statements in the server.log and they seem to have valid SQL:

            2003-06-25 10:29:27,544 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Site.ejbSelectUrlParameters] EJB-QL: select DISTINCT OBJECT(p) from Site s, IN(s.urlParameters) p where s=?1
            2003-06-25 10:29:27,564 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Site.ejbSelectUrlParameters] SQL: SELECT DISTINCT t0_p.UrlParameter_upk FROM SITE t1_s, URLPARAMETER t0_p WHERE ((t1_s.name=?)) AND (t1_s.name=t0_p.Site_urlParameters)