After great success with creating a number of CMP beans in 3.0.0, I have finally run 
into a snag.  

I have a number of CMP EEJBs that I've created that are set to create their own 
tables, etc. Those all seem to work fine. I then attempted to implement a new bean to 
access information in an existing table.  In this case, I have to explicity specify 
the table name and the mappings for the field-name <-> column name in the 
jbosscmp-jdbc.xml file.  When I try to use the findAll method on this bean, the 
request fails with an Oracle "missing expression" exception.

Undaunted, I have spent quite a bit of time perusing the server.log file, the cmp 
source code, buying the CMP documentation and have come to the conclusion that I am 
now daunted.  The server.log file shows the ultimate problem with the following lines 
generated during the deployment of the bean:

2002-06-04 16:29:27,453 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.EgadGenomeBean] Initializing CMP 
plugin for EgadGenomeBean
2002-06-04 16:29:27,489 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.EgadGenomeBean] Entity Exists 
SQL: SELECT COUNT(*) FROM EGAD.GENOME WHERE 
2002-06-04 16:29:27,490 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.EgadGenomeBean] Insert Entity 
SQL: INSERT INTO EGAD.GENOME (genomekey, genus, species, strain, chromosome) VALUES 
(?, ?, ?, ?, ?)
2002-06-04 16:29:27,490 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCRemoveEntityCommand.EgadGenomeBean] Remove SQL: 
DELETE FROM EGAD.GENOME WHERE
 
...snip...

2002-06-04 16:29:28,163 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.EgadGenomeBean] Table not create as 
requested: EGAD.GENOME
2002-06-04 16:29:28,163 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.EgadGenomeBean.findByPrimaryKey]
 SQL: SELECT  FROM EGAD.GENOME WHERE
2002-06-04 16:29:28,164 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.EgadGenomeBean] Added 
findByPrimaryKey query command for local home interface
2002-06-04 16:29:28,165 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.EgadGenomeBean.findAll] EJB-QL: 
                SELECT OBJECT(o)
                FROM EgadGenomeBean AS o
        
2002-06-04 16:29:28,170 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.EgadGenomeBean.findAll] SQL: SELECT  
FROM EGAD.GENOME t0_o

The entry in the ejb-jar.xml file:
    <entity>
      <ejb-name>EgadGenomeBean</ejb-name>
      <local-home>com.wyeth.vaxdb.egad.LocalEgadGenomeHome</local-home>
      <local>com.wyeth.vaxdb.egad.LocalEgadGenome</local>
      <ejb-class>com.wyeth.vaxdb.egad.EgadGenomeBean</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>EgadGenomeBean</abstract-schema-name>
      <cmp-field>
        <field-name>id</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>genus</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>species</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>strain</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>chromosome</field-name>
      </cmp-field>
      <query>
        <query-method>
          <method-name>findAll</method-name>
          <method-params></method-params>
        </query-method>

        <ejb-ql>
                SELECT OBJECT(o)
                FROM EgadGenomeBean AS o
        </ejb-ql>
      </query>
    </entity>

and the jbosscmp-jdbc.xml entry:
        <entity>
            <ejb-name>EgadGenomeBean</ejb-name>
            <datasource>java:/EgadDS</datasource>
            <datasource-mapping>Oracle8</datasource-mapping>
            <create-table>false</create-table>
            <remove-table>false</remove-table>
            <read-only>true</read-only>
            <read-time-out>600</read-time-out>
            <table-name>EGAD.GENOME</table-name>
            <cmp-field>
                <field-name>id</field-name>
                <column-name>genomekey</column-name>
            </cmp-field>
            <cmp-field>
                <field-name>genus</field-name>
                <column-name>genus</column-name>
            </cmp-field>
            <cmp-field>
                <field-name>species</field-name>
                <column-name>species</column-name>
            </cmp-field>
            <cmp-field>
                <field-name>strain</field-name>
                <column-name>strain</column-name>
            </cmp-field>
            <cmp-field>
                <field-name>chromosome</field-name>
                <column-name>chromosome</column-name>
            </cmp-field>
        </entity>

The obvious cause of the "missing element" exception is the generated SQL that does 
not include appropriate column names in the select clause (the where clauses also 
don't look very good).  Is there a configuration problem that I have created that 
would prevent the SQL from being generated properly or could this be an EJB-QL 
compiler problem?

The only other interesting configuration tidbit that I can think of is that I have two 
separate Oracle datasources configured, and this bean references a one while all of 
the other beans reference the other.



David P. Russell
Lead Technical Consultant
Idea Integration
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(585) 249-2600
(585) 273-7728

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

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

Reply via email to