Entity bean is not working
bernmic Sep 24, 2004 9:39 AMI'm trying to create a simple EJB application. I'm using Oracle 8i, JBoss 4.0.0 (and 3.2.5 without any difference), Eclipse 3.0 (WinXP) and JBossIDE 1.3.0.
I wrote a simple entity bean for an existing table, created and deployed the datasource MyDS file in JBoss. I used Standard EJB for XDoclet, with jboss tag (Version=4.0 / 3.2, datasource=java:/WiS2DS, datasourceMapping=Oracle8).
/**
* @ejb.bean name="PLZ_Basisdaten"
* display-name="PLZ_Basisdaten"
* description="Entitybean for table PLZ_BASISDATEN"
* jndi-name="ejb/PLZ_Basisdaten"
* type="CMP"
* cmp-version="2.x"
* view-type="both"
* primkey-field = "id_Plz_Basisdaten"
*
* @ejb.persistence table-name="PLZ_BASISDATEN"
*
* @jboss.persistence table-name = "PLZ_BASISDATEN"
* @ejb.util generate = "physical"
*/
public abstract class PLZ_BasisdatenBean implements EntityBean {
...
/**
* @ejb.interface-method view-type = "both"
* @ejb.persistent-field
* @ejb.persistence column-name = "ID_PLZ_BASISDATEN"
* @ejb.pk-field
*
* @return
*/
public abstract Integer getId_Plz_Basisdaten();
/**
* @ejb.interface-method view-type = "both"
*
* @param name
*/
public abstract void setId_Plz_Basisdaten(Integer id);
/**
* @ejb.interface-method view-type = "both"
* @ejb.persistent-field
* @ejb.persistence column-name = "BEZEICHNUNG"
*
* @return
*/
public abstract String getBezeichnung();
...
DataSource:
<local-tx-datasource>
<jndi-name>WiS2DS</jndi-name>
<connection-url>jdbc:oracle:thin:@192.168.1.66:1521:lotto</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>xxxx</user-name>
xxxx
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<type-mapping>Oracle9i</type-mapping>
</local-tx-datasource>
I can deploy the jar without a problem. But when I call the finder method from a client or a session bean I get the following exception.
13:31:48,078 DEBUG [PLZ_Basisdaten#findByPrimaryKey] Executing SQL: SELECT t0_PLZ_Basisdaten.id_Plz_Basisdaten FROM PLZ_BASISDATEN t0_PLZ_Basisdaten WHERE t0_PLZ_Basisdaten.id_Plz_Basisdaten=?
13:31:48,078 INFO [STDOUT] javax.ejb.ObjectNotFoundException: No such entity!
13:31:48,078 INFO [STDOUT] at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntityCommand.execute(JDBCFindEntityCommand.java:50)
13:31:48,078 INFO [STDOUT] at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntity(JDBCStoreManager.java:589)
13:31:48,078 INFO [STDOUT] at org.jboss.ejb.plugins.CMPPersistenceManager.findEntity(CMPPersistenceManager.java:300)
13:31:48,078 INFO [STDOUT] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnectionInterceptor.java:298)
13:31:48,078 INFO [STDOUT] at org.jboss.ejb.EntityContainer.findSingleObject(EntityContainer.java:1086)
13:31:48,078 INFO [STDOUT] at org.jboss.ejb.EntityContainer.findLocal(EntityContainer.java:663)
The SQL statement is running in SQL*Plus, so it can't be a database problem. Does anyone know something about this problem?
Regards, Michael