4 Replies Latest reply on Jun 11, 2004 8:19 PM by Jason Long

    Entity name confict problem in 3.24, but not 3.23

    Jason Long Master

      I have been using JBoss 3.2.3, but I wanted to switch to 3.2.4 for Tomcat 5. I could not get my project to deploy and I finally figured out why. I have an entity bean named Order and now with 3.2.4 the following error is thrown:
      Caused by: org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT OBJECT(o) FROM Order WHERE o.customer.userId = ?1'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "Order" at line 1, column 23.
      Was expecting one of:
      "IN" ...
      <ABSTRACT_SCHEMA> ...
      )

      The name Order is conflicting with the query language.

      I am just going rename the class. I am just posting this in case someone else runs into a similar problem.

        • 1. Re: Entity name confict problem in 3.24, but not 3.23
          Jason Long Master

          Unfortunatly I was wrong about the name causeing the problem. I renamed to CustOrder and Odr and got the same error message. The same ear file deploy perfectly on my 3.2.3 installation.

          I would appreciate any assistance. Let me know if more information is required.

          Here is the entity definition in my ejb-jar.xml file:

           <entity >
           <description><![CDATA[]]></description>
          
           <ejb-name>Order</ejb-name>
          
           <local-home>xpetstore.domain.order.interfaces.OrderLocalHome</local-home>
           <local>xpetstore.domain.order.interfaces.OrderLocal</local>
          
           <ejb-class>xpetstore.domain.order.ejb.OrderCMP</ejb-class>
           <persistence-type>Container</persistence-type>
           <prim-key-class>java.lang.Integer</prim-key-class>
           <reentrant>False</reentrant>
           <cmp-version>2.x</cmp-version>
           <abstract-schema-name>Order</abstract-schema-name>
           <cmp-field >
           <description><![CDATA[]]></description>
           <field-name>orderUId</field-name>
           </cmp-field>
           <cmp-field >
           <description><![CDATA[]]></description>
           <field-name>orderDate</field-name>
           </cmp-field>
           <cmp-field >
           <description><![CDATA[]]></description>
           <field-name>status</field-name>
           </cmp-field>
           <cmp-field >
           <description><![CDATA[]]></description>
           <field-name>street1</field-name>
           </cmp-field>
           <cmp-field >
           <description><![CDATA[]]></description>
           <field-name>street2</field-name>
           </cmp-field>
           <cmp-field >
           <description><![CDATA[]]></description>
           <field-name>city</field-name>
           </cmp-field>
           <cmp-field >
           <description><![CDATA[]]></description>
           <field-name>state</field-name>
           </cmp-field>
           <cmp-field >
           <description><![CDATA[]]></description>
           <field-name>zipcode</field-name>
           </cmp-field>
           <cmp-field >
           <description><![CDATA[]]></description>
           <field-name>country</field-name>
           </cmp-field>
           <cmp-field >
           <description><![CDATA[]]></description>
           <field-name>creditCardNumber</field-name>
           </cmp-field>
           <cmp-field >
           <description><![CDATA[]]></description>
           <field-name>creditCardType</field-name>
           </cmp-field>
           <cmp-field >
           <description><![CDATA[]]></description>
           <field-name>creditCardExpiryDate</field-name>
           </cmp-field>
           <primkey-field>orderUId</primkey-field>
          
           <ejb-local-ref >
           <ejb-ref-name>ejb/OrderItemLocal</ejb-ref-name>
           <ejb-ref-type>Entity</ejb-ref-type>
           <local-home>xpetstore.domain.order.interfaces.OrderItemLocalHome</local-home>
           <local>xpetstore.domain.order.interfaces.OrderItemLocal</local>
           <ejb-link>OrderItem</ejb-link>
           </ejb-local-ref>
           <ejb-local-ref >
           <ejb-ref-name>ejb/UIDGeneratorLocal</ejb-ref-name>
           <ejb-ref-type>Session</ejb-ref-type>
           <local-home>xpetstore.util.uidgen.interfaces.UIDGeneratorLocalHome</local-home>
           <local>xpetstore.util.uidgen.interfaces.UIDGeneratorLocal</local>
           <ejb-link>UIDGenerator</ejb-link>
           </ejb-local-ref>
          
           <query>
           <query-method>
           <method-name>findByCustomer</method-name>
           <method-params>
           <method-param>java.lang.String</method-param>
           </method-params>
           </query-method>
           <ejb-ql><![CDATA[SELECT OBJECT(o) FROM Order WHERE o.customer.userId = ?1]]></ejb-ql>
           </query>
           <!-- Write a file named ejb-finders-OrderEJB.xml if you want to define extra finders. -->
           </entity>
          


          • 2. Re: Entity name confict problem in 3.24, but not 3.23
            Mark Miller Newbie

            You need to change your abstract schema name to not be order.

            Mark

            • 3. Re: Entity name confict problem in 3.24, but not 3.23
              Jason Long Master

              I tried renaming, but was unsuccessful. Here is the xdoclet code that is generating what I sent before. Is this where I need to make the modifications? Does anyone know why this would suddenly stop working in 3.2.4?

              /**
               *
               * @ejb.bean
               * name="Order"
               * type="CMP"
               * view-type="local"
               * primkey-field="orderUId"
               * schema="Order"
               * cmp-version="${ejb.cmp.version}"
               * @ejb.value-object
               * name="Order"
               * match="*"
               * @ejb.transaction
               * type="Required"
               * @ejb.persistence
               * table-name="T_ORDER"
               * @ejb.finder
               * signature="Collection findByCustomer(java.lang.String userId)"
               * query="SELECT OBJECT(o) FROM Order WHERE o.customer.userId = ?1"
               * @ejb.ejb-ref
               * ejb-name="OrderItem"
               * view-type="local"
               * ref-name="ejb/OrderItemLocal"
               * @ejb.ejb-ref
               * ejb-name="UIDGenerator"
               * view-type="local"
               * ref-name="ejb/UIDGeneratorLocal"
               *
               * @jboss.persistence
               * create-table="${jboss.create.table}"
               * remove-table="${jboss.remove.table}"
               */
              


              • 4. Re: Entity name confict problem in 3.24, but not 3.23
                Jason Long Master

                After 8 hours sleep I finally got the syntax right.

                I needed to change schema to "wtf", the query to "SELECT OBJECT(o) FROM wtf AS o WHERE o.customer.userId = ?1", and add "AS o".

                /**
                 *
                 * @ejb.bean
                 * name="Order"
                 * type="CMP"
                 * view-type="local"
                 * primkey-field="orderUId"
                 * schema="wtf"
                 * cmp-version="${ejb.cmp.version}"
                 * @ejb.value-object
                 * name="Order"
                 * match="*"
                 * @ejb.transaction
                 * type="Required"
                 * @ejb.persistence
                 * table-name="T_ORDER"
                 * @ejb.finder
                 * signature="Collection findByCustomer(java.lang.String userId)"
                 * query="SELECT OBJECT(o) FROM wtf AS o WHERE o.customer.userId = ?1"
                 * @ejb.ejb-ref
                 * ejb-name="OrderItem"
                 * view-type="local"
                 * ref-name="ejb/OrderItemLocal"
                 * @ejb.ejb-ref
                 * ejb-name="UIDGenerator"
                 * view-type="local"
                 * ref-name="ejb/UIDGeneratorLocal"
                 *
                 * @jboss.persistence
                 * create-table="${jboss.create.table}"
                 * remove-table="${jboss.remove.table}"
                 */