Got an EJB 2.0 Entity bean using CMP 2.0. Server is JBoss 3 and Oracle
8i (8.1.7).

Everything deploys fine. When I do a findByPrimaryKey()(see descriptions
below) I get the following error:
javax.ejb.FinderException: Find failed: java.sql.SQLException: ORA-00904: invalid 
column name

By setting <debug>true</debug> in jbosscmp-jdbc.xml, I see that the SQL
being run is:
[org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Permit.findByPrimaryKey] 
Executing SQL: SELECT permitNbr FROM PERMIT WHERE permitNbr=?

Of course, permitNbr represents the Primary Key. I've set a mapping in
jbosscmp-jdbc.xml for that field. The actual Database column name is
PERMIT_NBR. Here is my jbosscmp-jdbc.xml:

<jbosscmp-jdbc>
   <enterprise-beans>
      <entity>
         <ejb-name>Permit</ejb-name>
         <table-name>PERMIT</table-name>
         <datasource>java:/OracleDS</datasource>
         <type-mapping>Oracle8</type-mapping>
         <debug>true</debug>
         <create-table>false</create-table>
         <remove-table>false</remove-table>
         <read-only>false</read-only>
         <time-out>300</time-out>
         <select-for-update>false</select-for-update>
         <pk-constraint>true</pk-constraint>
         <read-ahead>true</read-ahead>
         <cmp-field>
            <field-name>permitNbr</field-name>
            <column-name>PERMIT_NBR</column-name>
         </cmp-field>
      </entity>
    </enterprise-beans>
</jbosscmp-jdbc>

From looking at the SQL Statement being run, it appears that the
cmp-field mapping is being ignored. I'm pretty sure that JBoss is
reading the file, as I've set debug = true, which is not the default,
and its spitting out debug info. 

Any input would be greatly appreciated.

Here's some more info:
  [ejb-jar.xml exerpt
]
    <entity>
      <display-name>Permit</display-name>
      <ejb-name>Permit</ejb-name>
      <local-home>com.cdplusonline.permitting.LocalPermitHome</local-home>
      <local>com.cdplusonline.permitting.LocalPermit</local>
      <ejb-class>com.cdplusonline.permitting.PermitBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.math.BigDecimal</prim-key-class>
      <reentrant>False</reentrant>
      <abstract-schema-name>Permit</abstract-schema-name>
      <cmp-field>
        <field-name>permitNbr</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>altKey</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>type</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>status</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>dba</field-name>
      </cmp-field>
      <primkey-field>permitNbr</primkey-field>
    </entity>


-- 
Bryce Fischer <[EMAIL PROTECTED]>


----------------------------------------------------------------------------
                   Bringing you mounds of caffeinated joy
                   >>>     http://thinkgeek.com/sf    <<<

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to