- This topic has 4 replies, 3 voices, and was last updated 20 years, 9 months ago by
bernmic.
-
AuthorPosts
-
bernmicMemberI’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 MyEclipseIDE 3.8.1. I updated the XDoclet to 1.2.1 (make also no difference).
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, datasource=java:/MyDS, 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();
…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
September 24, 2004 at 8:27 am #215896
Riyad KallaMemberI’ve asked our EJB guy to have a look at this.
September 24, 2004 at 2:08 pm #215935
GregMemberMichael,
Can you post the code that is actually throwing the error? Just looking at the EJB it is hard to tell what else might be going on.
September 27, 2004 at 5:48 am #216006
bernmicMemberNo problem. This is the session bean wich calls the entity bean.
The error occurs at the findByPrimaryKey call.Michael
package de.deutschepost.wis2.ejb;
import de.deutschepost.wis2.interfaces.*;
import javax.ejb.*;
import javax.ejb.SessionBean;
import javax.naming.NamingException;
import java.rmi.RemoteException;/**
* @ejb.bean name=”UserService” display-name=”Name for UserService”
* description=”Description for UserService”
* jndi-name=”ejb/UserService” type=”Stateless” view-type=”remote”
*/
public class UserServiceBean implements SessionBean
{
/**
*
*/
public UserServiceBean()
{
super();
// TODO Auto-generated constructor stub
}/*
* (non-Javadoc)
*
* @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
*/
public void setSessionContext(SessionContext ctx) throws EJBException, RemoteException
{
// TODO Auto-generated method stub
}/**
* Default create method
*
* @throws CreateException
* @ejb.create-method
*/
public void ejbCreate() throws CreateException
{
// TODO Auto-generated method stub
}/*
* (non-Javadoc)
*
* @see javax.ejb.SessionBean#ejbRemove()
*/public void ejbRemove() throws EJBException, RemoteException
{
// TODO Auto-generated method stub
}/*
* (non-Javadoc)
*
* @see javax.ejb.SessionBean#ejbActivate()
*/
public void ejbActivate() throws EJBException, RemoteException
{
// TODO Auto-generated method stub
}/*
* (non-Javadoc)
*
* @see javax.ejb.SessionBean#ejbPassivate()
*/
public void ejbPassivate() throws EJBException, RemoteException
{
// TODO Auto-generated method stub
}/**
* Business method
*
* @ejb.interface-method view-type = “remote”
*/
public String loginUser(String userName, String password)
{
try
{
PLZ_BasisdatenLocalHome home = PLZ_BasisdatenUtil.getLocalHome();
//PLZBasisdatenPK pk = new PLZBasisdatenPK(new Integer(28548));
PLZ_BasisdatenLocal bean = home.findByPrimaryKey(new Integer(28548));
System.out.println(“Found: “+bean.getBezeichnung());
}
catch (NamingException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (FinderException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return “HelloWorld to ” + userName;
}
}September 27, 2004 at 5:50 am #216007
bernmicMemberAnd this is the complete entity bean:
package de.deutschepost.wis2.ejb;
import de.deutschepost.wis2.interfaces.PLZ_BasisdatenData;
import javax.ejb.*;
import javax.ejb.EntityBean;
import java.rmi.RemoteException;/**
* @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 {
/**
*
*/
public PLZ_BasisdatenBean() {
super();
// TODO Auto-generated constructor stub
}/* (non-Javadoc)
* @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
*/
public void setEntityContext(EntityContext ctx) throws EJBException, RemoteException {
// TODO Auto-generated method stub
}/* (non-Javadoc)
* @see javax.ejb.EntityBean#unsetEntityContext()
*/
public void unsetEntityContext() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbRemove()
*/
public void ejbRemove() throws RemoveException, EJBException, RemoteException {
// TODO Auto-generated method stub
}/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbActivate()
*/
public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbPassivate()
*/
public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbLoad()
*/
public void ejbLoad() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbStore()
*/
public void ejbStore() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/**
* @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();/**
* @ejb.interface-method view-type = “both”
*
* @param name
*/
public abstract void setBezeichnung(String name);/**
* Getter for CMP Field ADM_KENNUNG
*
*
* @ejb.persistence column-name = “ADM_KENNUNG”
* @ejb.persistent-field
* @ejb.interface-method view-type=”both”
*/
public abstract String getADM();/**
* Setter for CMP Field ADM_KENNUNG
*
* @ejb.interface-method view-type=”both”
*/
public abstract void setADM(String value);/**
* Getter for CMP Field PLZ
*
*
* @ejb.persistence column-name = “PLZ”
* @ejb.persistent-field
* @ejb.interface-method view-type=”both”
*/
public abstract String getPLZ();/**
* Setter for CMP Field PLZ
*
* @ejb.interface-method view-type=”both”
*/
public abstract void setPLZ(String value);/**
* Getter for CMP Field ANZAHL_BEWOHNER
*
*
* @ejb.persistence column-name = “ANZAHL_BEWOHNER”
* @ejb.persistent-field
* @ejb.interface-method view-type=”both”
*/
public abstract Integer getAnzahlEinwohner();/**
* Setter for CMP Field ANZAHL_BEWOHNER
*
* @ejb.interface-method view-type=”both”
*/
public abstract void setAnzahlEinwohner(Integer value);/**
* Getter for CMP Field ANZAHL_HAUSHALTE
*
*
* @ejb.persistence column-name = “ANZAHL_HAUSHALTE”
* @ejb.persistent-field
* @ejb.interface-method view-type=”both”
*/
public abstract Integer getAnzahlHaushalte();/**
* Setter for CMP Field ANZAHL_HAUSHALTE
*
* @ejb.interface-method view-type=”both”
*/
public abstract void setAnzahlHaushalte(Integer value);/**
* Getter for CMP Field FLAECHE
*
*
* @ejb.persistence column-name = “FLAECHE”
* @ejb.interface-method view-type=”both”
*/
public abstract Double getFlaeche();/**
* Setter for CMP Field FLAECHE
*
* @ejb.interface-method view-type=”both”
*/
public abstract void setFlaeche(Double value);/**
* Create method
* @ejb.create-method view-type = “both”
*/
public Integer ejbCreate(PLZ_BasisdatenData data)
throws javax.ejb.CreateException {
// TODO Auto-generated method stub
return null;
}
/**
* Post Create method
*/
public void ejbPostCreate(PLZ_BasisdatenData data) throws javax.ejb.CreateException {
// TODO Auto-generated method stub
}
} -
AuthorPosts