4 Replies Latest reply on Feb 18, 2005 1:14 PM by dhoang

    Dynamic Query Search - @jboss.query

      I used the following EJB-QL in the dynamic query search (I tried it in finder method and it worked):

      "select object(a) from TestDateSchema as a where a.tstampDate > ?1 and a.tstampDate < ?2" --- where a.tstampDate is java.sql.Timestamp and two arguments (?1 = start date and ?2 = end date)...

      ...and here is the statement to get a collection...

      java.sql.Timestamp gotTimestamp;

      Collection lc = myBeanHome.getGeneric(jbossql.toString(), args);

      ...and Iteration and while loop...

      while(iter1.hasNext()){
      TestDateLocal mydate = (TestDateLocal)iter1.next();
      gotTimestamp = mydate.getTstampDate(); // This statement returns error
      } }

      TestDateLocal (extends EJBLocalObject) has the getTstampDate method and this method returns the following message:

      java.lang.NullPointerException
      at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:44)
      at $Proxy1.getKey(Unknown Source)
      at com.testdate.TestDateClient.testBean(TestDateClient.java:127)
      at com.testdate.TestDateClient.main(TestDateClient.java:145)


      I had checked entire EJBsrc folder for all files but I came up nothing...Please let me know if you have encountered this problem before.

      Thanks...

        • 1. Re: Dynamic Query Search - @jboss.query

          You cannot access "Local" EJBs outside your app VM. Can you? I guess that could be a reason for your exception.

          Thanks,
          Kalyan.

          • 2. Re: Dynamic Query Search - @jboss.query



            Thanks for your reply...

            Yes, I was able to access to the Local...

            I built the TestDateBean Client within Eclipse. I had a data in TestDateLocal but when I used the getTstampDate method in that Local class and it returned Null exception. Actually, all the rows in the database were in the collection...

            I will rebuilt the test for TestDateBean in Jbuilder and test again...This is where all of our Beans were generated...

            Thanks again...

            • 3. Re: Dynamic Query Search - @jboss.query

              Are your client and bean running in different VMs? If so, you can't access a local ejbean from your client. Local beans are different from Remote beans.

              Thanks,
              Kalyan.

              • 4. Re: Dynamic Query Search - @jboss.query


                Hello Kalyan,

                My Client and and Bean are in the same VM...This is a simple test case for a java.sql.Timestamp. I do not see why the Finder method is working but the dynamic query (using @jboss.query) failed. They should not be different as far as how to access to the table except the JBOSS-QL has more arguments (or conditions) to search...

                Regards,
                dhoang