1 Reply Latest reply on Mar 30, 2006 4:09 PM by frankeeeh

    FROM not found because of dynamic query

    frankeeeh

      Hey,

      i've been trying to get a dynamic query to work but when i deploy my package i get the error 'FROM not found' on a totally different class. I already found through google and this forum it points to the wrong class and i know the problem is in my dynamic query because without it, it deploys without any problem.

      I use the following code:

      /**
       *
       * Entitybean for StudentTable
       *
       * @ejb.bean name="Student"
       * display-name="Name for Student"
       * description="Description for Student"
       * jndi-name="ejb/Student"
       * type="CMP"
       * cmp-version="2.x"
       * view-type="local"
       * primkey-field="studentNumber"
       *
       * @jboss.query
       * dynamic = "true";
       * signature = "java.util.Collection ejbSelectGeneral(java.lang.String query, java.lang.Object[] args)"
       */
      public abstract class StudentBean implements EntityBean {
      
       // ... useuall stuff
      
       /**
       * @ejb.interface-method
       */
       public abstract java.util.Collection ejbSelectGeneral(java.lang.String query, Object[] args) throws FinderException;
      
       /**
       * @ejb.home-method
       * view-type="local"
       */
       public java.util.Collection ejbHomeSearchStudents(java.lang.String query, java.lang.Object[] args) throws FinderException {
       StringBuffer jbossQl = new StringBuffer();
       jbossQl.append("SELECT OBJECT(l) ");
       jbossQl.append("FROM Student s, IN(s.labels) l ");
       jbossQl.append("WHERE ");
       jbossQl.append(query);
      
       return ejbSelectGeneral(jbossQl.toString(), args);
       }
      
      }
      


      I'm not sure if the StringBuffer was required but it didn't matter anyway. I got the same error. I really hope someone can help me with this problem as i need to fix it asap!

      I use the latest version of Eclipse with the JBoss IDE plugin and JBoss server 4.0.3.

      Thanks in advance.

        • 1. Re: FROM not found because of dynamic query
          frankeeeh

          hmm after lots and lots of trouble i got it working... sort of...
          it seems that generating the xdoclet via eclipse doesn't add the query to the jbosscmp-jdbc.xml. I added it manually and it works now.

          Any idea what the answer to this problem could be?