2 Replies Latest reply on Jul 13, 2004 2:57 AM by morenito9000

    findByPrimaryKey fails, empty SQL SELECT command

    morenito9000

      HI all,
      I'm writing an entity bean (ProdottoBean) referred by a session bean.
      The session bean isn't unable to retrieve the entity using the
      findByPrimaryKey method().

      In server.log I see this debug lines:

      **********************************************************

      [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Prodotto#findByPrimaryKey] Executing SQL: SELECT FROM prodotto WHERE

      [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Prodotto#findByPrimaryKey] Find failed

      java.sql.SQLException: ERROR: parser: parse error at or near "FROM"

      **********************************************************

      The ejb-jar.xml file (for what concerne entity's tags):

      <entity>
       <description></description>
       <display-name>Prodotto Bean</display-name>
       <ejb-name>Prodotto</ejb-name>
       <local-home>server.entity.interfacce.ProdottoLocalHome</local-home>
       <local>server.entity.interfacce.ProdottoLocal</local>
      
       <ejb-class>server.entity.beans.ProdottoBean</ejb-class>
       <persistence-type>Container</persistence-type>
       <prim-key-class>java.lang.String</prim-key-class>
       <reentrant>False</reentrant>
       <cmp-version>2.x</cmp-version>
       <abstract-schema-name>Prodotto</abstract-schema-name>
      
       <cmp-field>
       <description></description>
       <field-name>nome</field-name>
       </cmp-field>
       <cmp-field>
       <description></description>
       <field-name>flagAttivo</field-name>
       </cmp-field>
       <cmp-field>
       <description></description>
       <field-name>ultimaMalf</field-name>
       </cmp-field>
      
       <resource-ref>
       <res-ref-name>jdbc/XmalfDB</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>
      </entity>
      

      *******************************************************

      The jbosscmp-jdbc.xml file

      <entity>
      <ejb-name>Prodotto</ejb-name>
       <table-name>prodotto</table-name>
      
       <cmp-field>
       <field-name>nome</field-name>
       <column-name>nome</column-name>
       </cmp-field>
       <cmp-field>
       <field-name>flagAttivo</field-name>
       <column-name>flag_attivo</column-name>
       </cmp-field>
       <cmp-field>
       <field-name>ultimaMalf</field-name>
       <column-name>ultima_malf</column-name>
       </cmp-field>
      </entity>


      It seems to me that JBOSS "doesn't see" the cmp fields
      of table PRODOTTO, but I don't know where I'm wrong :-(

      Many thanks for your helps,
      Moreno