0 Replies Latest reply on Dec 4, 2002 8:05 AM by rafonso

    quotations marks in JBoss 3.0.4 and Oracle 8

    rafonso

      Hello:

      I am using JBoss 3.0.4 with Oracle 8 as database. I have a EJB called Country whose primary key is called "countryId" that is a BigDecimal. In jbosscmp-jdbc.xml, this EJB is represented as below:

      <enterprise-beans>

      <ejb-name>Country</ejb-name>
      <table-name>COUNTRY</table-name>
      <ejb-designer-id>Country</ejb-designer-id>
      <cmp-field>
      <field-name>countryId</field-name> <!-- It is a BigDecimal -->
      <column-name>country_id</column-name> <!-- It is a NUMBER -->
      </cmp-field>
      <cmp-field>
      <field-name>countryName</field-name> <!-- It is a String -->
      <column-name>country_name</column-name> <!-- It is a Varchar -->
      </cmp-field>


      If I execute a method like findByPrimaryKey() (by countryId) or findByCountryName(), I get this message:

      javax.ejb.FinderException: Find failed: java.sql.SQLException: ORA-00904: Column name invalid

      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)

      I discovered that if I write a query like this:

      SELECT * FROM COUNTRY WHERE country_id = 1

      I get the same message from Oracle. ("ORA-00904: Column name invalid"). But if I put quotations marks in column name like this:

      SELECT * FROM COUNTRY WHERE "country_id" = 1

      It works. So I changed my jbosscmp-jdbc.xml to this form:

      <enterprise-beans>

      <ejb-name>Country</ejb-name>
      <table-name>COUNTRY</table-name>
      <ejb-designer-id>Country</ejb-designer-id>
      <cmp-field>
      <field-name>countryId</field-name>
      <column-name>"country_id"</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>countryName</field-name>
      <column-name>"country_name"</column-name>
      </cmp-field>


      And JBoss works too.
      So, my question is: How can I do to JBoss put quotations marks in column names before do queries? Or How can I change Oracle configuration to excuse quotations marks in column names?

      Thanks,

      Rafael U. C. Afonso