Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Jboss 3.0.4 CMP2 with Oracle 8.1.6

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
<entity>
<description>Test Entity Bean ( Container-managed Persistence
)</description>
<display-name>TestCmpEntityEJB</display-name>
<ejb-name>TestCmpEntityEJB</ejb-name>
<home>carro.test.ejb.entity.cmp.TestCmpEntityEJBHome</home>
<remote>carro.test.ejb.entity.cmp.TestCmpEntityEJB</remote>
<ejb-class>carro.test.ejb.entity.cmp.TestCmpEntityEJBBean</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>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>
</entity>
</enterprise-beans>
</ejb-jar>
<jboss>
<enterprise-beans>
<entity>
<ejb-name>TestCmpEntityEJB</ejb-name>
<jndi-name>test/ejb/entity/TestCmpEntityEJBHome</jndi-name>
</entity>
</enterprise-beans>
</jboss>
<jbosscmp-jdbc>
<defaults>
<datasource>java:/OracleDS</datasource>
<datasource-mapping>Oracle8</datasource-mapping>
</defaults>
<enterprise-beans>
<entity>
<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>
</entity>
</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;
}
 
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic