0 Replies Latest reply on Mar 10, 2003 4:08 AM by Cristiano

    JBoss 3.0.4 cmp2 and OIracle8

    Cristiano Newbie

      Help me!!! I work with JBoss 3.0.4 and Oracle 8.1.6 and I do not
      succeed to make to work correctly a simple entity bena CMP
      The code generated automatically from the container for the finder by
      primary key is not correctly ended. Why?

      My table is:

      CREATE TABLE TABLETEST1
      (
      ID NUMBER(10) NOT NULL,
      DESCRIZIONE VARCHAR2(255) NOT NULL,
      CONSTRAINT PK_TEST1 PRIMARY KEY (id)
      );


      This is JBOSS log

      2003-02-05 20:46:54,809 DEBUG
      [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.TestCmpEntityEJB.findByPrimaryKey]
      Executing SQL: SELECT FROM TABLETEST1 WHERE
      2003-02-05 20:46:54,809 DEBUG
      [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.TestCmpEntityEJB.findByPrimaryKey]
      Find failed
      java.sql.SQLException: ORA-00936: espressione mancante

      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
      at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
      at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:542)
      at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1311)
      at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:595)
      at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:1600)
      at oracle.jdbc.driver.OracleStatement.doExecute(OracleStatement.java:1758)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1805)
      at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:322)
      at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:280)
      at org.jboss.resource.adapter.jdbc.local.LocalPreparedStatement.executeQuery(LocalPreparedStatement.java:289)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:112)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntityCommand.execute(JDBCFindEntityCommand.java:44)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntity(JDBCStoreManager.java:541)
      at org.jboss.ejb.plugins.CMPPersistenceManager.findEntity(CMPPersistenceManager.java:336)
      [...]

      My XML configuration file:

      <ejb-jar>
      <enterprise-beans>

      Test Entity Bean ( Container-managed Persistence
      )
      <display-name>TestCmpEntityEJB</display-name>
      <ejb-name>TestCmpEntityEJB</ejb-name>
      carro.test.ejb.entity.cmp.TestCmpEntityEJBHome
      carro.test.ejb.entity.cmp.TestCmpEntityEJB
      <ejb-class>carro.test.ejb.entity.cmp.TestCmpEntityEJBBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Integer</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>TableTest1</abstract-schema-name>
      <cmp-field><field-name>id</field-name></cmp-field>
      <cmp-field><field-name>descrizione</field-name></cmp-field>
      <primary-field>id</primary-field>
      <security-identity><use-caller-identity/></security-identity>

      </enterprise-beans>
      </ejb-jar>


      <enterprise-beans>

      <ejb-name>TestCmpEntityEJB</ejb-name>
      <jndi-name>test/ejb/entity/TestCmpEntityEJBHome</jndi-name>

      </enterprise-beans>


      <jbosscmp-jdbc>


      java:/OracleDS
      <datasource-mapping>Oracle8</datasource-mapping>


      <enterprise-beans>

      <ejb-name>TestCmpEntityEJB</ejb-name>
      <table-name>TABLETEST1</table-name>
      <cmp-field>
      <field-name>id</field-name>
      <column-name>ID</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>descrizione</field-name>
      <column-name>DESCRIZIONE</column-name>
      </cmp-field>

      </enterprise-beans>
      </jbosscmp-jdbc>

      and my source code:


      public interface TestCmpEntityEJB extends EJBObject
      {

      /* business method for CMP field (not for primary key)
      is not necessary in Remote Interface. */
      public String getDescrizione() throws RemoteException;

      }



      public abstract class TestCmpEntityEJBBean implements EntityBean
      {
      public EntityContext entityContext;

      /* Method for CMP field */
      /* ... for primary key */
      public abstract Integer getId();
      public abstract void setId(Integer id);
      /* ... for other CMP field */
      public abstract String getDescrizione();
      public abstract void setDescrizione(String desc);


      public Integer ejbCreate(Integer id, String desc) throws
      CreateException
      {
      /* primary key setting */
      this.setId(id);
      /* CMP field setting */
      this.setDescrizione(desc);
      return null;
      }

      public void ejbPostCreate(Integer id, String description)
      {
      }

      [...]
      }

      public interface TestCmpEntityEJBHome extends EJBHome
      {
      /* create has the same signature of ejbCreate in bean class */
      TestCmpEntityEJB create(Integer id, String desc) throws
      RemoteException, CreateException;

      TestCmpEntityEJB findByPrimaryKey(Integer primaryKey) throws
      RemoteException, FinderException;

      Collection findAll() throws RemoteException, FinderException;
      }