7 Replies Latest reply on Aug 20, 2004 12:12 PM by pique

    ABSTRACT_SCHEMA problem with ejb-ql

    harshi2003

      hello,

      In my application i want to implement a wild card search. for that i planned to use LIKE key word with ejb-ql. i have used the follwoing query (as instructed in the forum ) i have overload the ejbql query with jboss-query.

      following shows the queries i defined

      * @ejb.finder signature = "java.util.Collection findByConsigneeStatus(java.lang.String consigneeRef,java.lang.String orderStatus)"
      * query = "SELECT OBJECT(o) FROM Order o WHERE o.consigneeReference LIKE '?1%' AND o.workflowStatus = ?2"
      *
      *@jboss.query signature = "java.util.Collection findByConsigneeStatus(java.lang.String consigneeRef,java.lang.String orderStatus)"
      * query = "SELECT OBJECT(o) FROM Order o WHERE o.consigneeReference LIKE ?1 AND o.workflowStatus = ?2"
      *

      when i run the xdoclet it doesnot give any errors. but when i deploy the application i get following error.

      "Order" at line 1, column 23.
      Was expecting one of:
      "IN" ...
      <ABSTRACT_SCHEMA> ...
      )]

      could pls tell me what do i need to do to over com this problem.

      i have checked the table names. there are similar as above. i am using jboss3.2.3 with mysql as the database.

      thanks in advance.

        • 1. Re: ABSTRACT_SCHEMA problem with ejb-ql
          aloubyansky

          Order is a reserved word. Choose something different.

          • 2. Re: ABSTRACT_SCHEMA problem with ejb-ql
            harshi2003

            Thank you very much for your reply.

            As you said because of the order keyword it causes the problems.

            in my application order is an entity bean.

            but for the finder methods like

            @ejb.finder signature = "java.util.Collection findByConsigneeDate(java.lang.String consigneeRef,java.util.Date orderDate)"
            * query = "SELECT OBJECT(o) FROM Order o WHERE o.consigneeReference = ?1 AND o.orderDate = ?2"

            the mentioned error is not coming. It deploys successfully.
            the major problem is i can not change name of that bean.

            could you pls make some suggesstions.

            thank you

            • 3. Re: ABSTRACT_SCHEMA problem with ejb-ql
              aloubyansky

              You have change the abstract schema name to something else. The queries are compiled at deploy time (except for dynamic ones). So how does that deploy successfully?

              • 4. Re: ABSTRACT_SCHEMA problem with ejb-ql
                harshi2003

                i am using xdoclet to generate ejb.jar and jboss.jar.

                i have define finder methods without using like as follows.
                @ejb.finder signature = "java.util.Collection findByOrderStatus(java.lang.String orderStatus)"
                * query = "SELECT OBJECT(o) FROM Order o WHERE o.workflowStatus = ?1"

                it is working ok. when deploying it doesn't throw any exceptions.

                since i want to implement the wildcard search i have used like keyword and implement the query as i mentioned.

                then i got that error for order bean.

                but as u said when define find methods with like for country bean it works ok.

                so i have n't change the abstract shema.

                pls help me

                • 5. Re: ABSTRACT_SCHEMA problem with ejb-ql
                  harshi2003

                  i forget to add one thing. i get this error only when i use jboss.query with Like.
                  if i use ejb finder without jboss.query not getting this error.

                  is there anyway i could use order as bean jndi name and use above queries.

                  you reply is very much appriciated.

                  • 6. Re: ABSTRACT_SCHEMA problem with ejb-ql
                    pique

                    Is ORDERING so may cause problem?

                    <jboss-ql><![CDATA[SELECT OBJECT(aa) FROM AccountAnal aa WHERE aa.account.id = ?1 order by aa.ordering]]></jboss-ql>

                    and error - generated query has starnge "table-name" after from

                    SELECT t0_aa.id, t0_aa.ordering
                    FROM TABLE-NAME = "ACCOUNTANAL" t0_aa,
                    ACCOUNT t1_aa_account
                    WHERE (t1_aa_account.id = ? AND
                    t0_aa.account_id=t1_aa_account.id)
                    ORDER BY t0_aa.ordering ASC

                    • 7. Re: ABSTRACT_SCHEMA problem with ejb-ql
                      pique

                      Version JBoss 3.2.5