3 Replies Latest reply on Apr 24, 2002 9:20 AM by lesne

    Define specific columns with CMP2 and EJB-QL

    lesne Newbie

      I want to use EJB-QL to access my database (Oracle 8.1.7). That's fine if fields and columns names are equals. But when I change table or column name in jaws.xml and EJB-QL, the parser don't accept EJB-QL.

      It is possible to not map CMP field (with EJB-QL) and database representation ?

      ###################
      EJB-JAR.XML
      ###################
      ...
      <enterprise-beans>

      <ejb-name>Product</ejb-name>
      interfaces.ProductHome
      interfaces.Product
      <ejb-class>beans.ProductBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>PRODUCT</abstract-schema-name>
      <cmp-field><field-name>productID</field-name></cmp-field>
      <cmp-field><field-name>name</field-name></cmp-field>
      <cmp-field><field-name>description</field-name></cmp-field>
      <cmp-field><field-name>basePrice</field-name></cmp-field>
      <primkey-field>productID</primkey-field>


      <query-method>
      <method-name>findAllProducts</method-name>
      <method-params>
      </method-params>
      </query-method>
      <ejb-ql>
      <![CDATA[SELECT OBJECT(p) FROM PRODUCT p WHERE p.productID IS NOT NULL]]>
      </ejb-ql>

      ...


      ###################
      JAWS.XML
      ###################
      ...
      <enterprise-beans>

      <ejb-name>Product</ejb-name>
      <table-name>PRODUCT</table-name>
      <create-table>false</create-table>
      <remove-table>false</remove-table>

      <cmp-field>
      <field-name>productID</field-name>
      <column-name>ID</column-name>
      </cmp-field>
      <cmp-field>
      ...


      EJB-QL Parser don't accept:
      <![CDATA[SELECT OBJECT(p) FROM PRODUCT p WHERE p.ID IS NOT NULL]]>

      Thanks to help me !!