Throws CreateException should be added to public Integer ejb
shanker May 21, 2003 7:30 AMI am new to j2ee & jboss. I am using jboss3.2.0_tomcat-4.1.24. Please help me. Thanks in advance. Here is my code.
File : Employee.java
package com.amc.amchr;
import java.util.List;
import javax.ejb.*;
import java.rmi.RemoteException;
import java.util.Date;
import com.amc.amchr.EmployeeVO;
public interface Employee extends EJBObject
{
Integer getEmployeeId() throws RemoteException;
String getEmployeeFirstName() throws RemoteException;
String getEmployeeLastName() throws RemoteException;
String getEmployeeEmailId() throws RemoteException;
void setEmployeeId(Integer employeeId) throws RemoteException;
void setEmployeeFirstName(String employeeFirstName) throws RemoteException;
void setEmployeeLastName(String employeeLastName) throws RemoteException;
void setEmployeeEmailId(String employeeEmailId) throws RemoteException;
EmployeeVO getEmployee() throws RemoteException;
}
File : EmployeeBean.java
package com.amc.amchr;
import javax.ejb.EntityContext;
import javax.ejb.CreateException;
import javax.ejb.DuplicateKeyException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.ejb.EJBException;
import java.util.Collection;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Date;
public abstract class EmployeeBean implements javax.ejb.EntityBean
{
private EntityContext entityContext;
public abstract Integer getEmployeeId();
public abstract void setEmployeeId(Integer employeeId);
public abstract String getEmployeeFirstName();
public abstract void setEmployeeFirstName(String employeeFirstName);
public abstract String getEmployeeLastName();
public abstract void setEmployeeLastName(String employeeLastName);
public abstract String getEmployeeEmailId();
public abstract void setEmployeeEmailId(String employeeEmailId);
public Integer ejbCreate (EmployeeVO tempObject)
{
setEmployeeId(tempObject.employeeId);
setEmployeeFirstName(tempObject.employeeFirstName);
setEmployeeLastName(tempObject.employeeLastName);
setEmployeeEmailId(tempObject.employeeEmailId);
return null;
}
public void ejbPostCreate (EmployeeVO tempObject)
{
}
public void setEntityContext(javax.ejb.EntityContext _entityContext) throws javax.ejb.EJBException, java.rmi.RemoteException
{
this.entityContext = _entityContext;
}
public void unsetEntityContext() throws javax.ejb.EJBException, java.rmi.RemoteException
{
this.entityContext = null;
}
public void ejbLoad() throws javax.ejb.EJBException, java.rmi.RemoteException
{
}
public void ejbStore() throws javax.ejb.EJBException, java.rmi.RemoteException
{
}
public void ejbActivate() throws javax.ejb.EJBException, java.rmi.RemoteException
{
}
public void ejbPassivate() throws javax.ejb.EJBException, java.rmi.RemoteException
{
}
public void ejbRemove() throws javax.ejb.RemoveException, javax.ejb.EJBException, java.rmi.RemoteException
{
}
public EmployeeVO getEmployeeVO()
{
EmployeeVO employeeVO = new EmployeeVO(
this.getEmployeeId(),
this.getEmployeeFirstName(),
this.getEmployeeLastName(),
this.getEmployeeEmailId(),
return employeeVO;
}
}
File : EmployeeHome.java
package com.amc.amchr;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
import java.rmi.RemoteException;
import java.util.Collection;
import javax.ejb.*;
import com.amc.amchr.EmployeeVO;
import com.amc.amchr.Employee;
public interface EmployeeHome extends javax.ejb.EJBHome
{
public Employee create(EmployeeVO tempObject) throws CreateException, RemoteException;
public Employee findByPrimaryKey(Integer primaryKey) throws FinderException, RemoteException;
public Collection findAll() throws FinderException, RemoteException;
}
File : EmployeeHomeLocal.java
package com.amc.amchr;
import javax.ejb.FinderException;
import javax.ejb.CreateException;
import java.util.Collection;
import javax.ejb.*;
import com.ami.amihr.EmployeeVO;
import com.ami.amihr.EmployeeLocal;
public interface EmployeeHomeLocal extends javax.ejb.EJBLocalHome
{
public EmployeeLocal createEmployee(EmployeeVO tempObject) throws CreateException;
public EmployeeLocal findByPrimaryKey(Integer primarykey) throws FinderException;
public Collection findAll() throws FinderException;
}
File : EmployeeLocal.java
package com.amc.amchr;
import java.util.List;
import javax.ejb.*;
import java.rmi.RemoteException;
import java.util.Date;
import com.amc.amchr.EmployeeVO;
public interface EmployeeLocal extends EJBLocalObject
{
Integer getEmployeeId() throws RemoteException;
String getEmployeeFirstName() throws RemoteException;
String getEmployeeLastName() throws RemoteException;
String getEmployeeEmailId() throws RemoteException;
void setEmployeeId(Integer employeeId) throws RemoteException;
void setEmployeeFirstName(String employeeFirstName) throws RemoteException;
void setEmployeeLastName(String employeeLastName) throws RemoteException;
void setEmployeeEmailId(String employeeEmailId) throws RemoteException;
EmployeeVO getEmployee() throws RemoteException;
}
File : ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<display-name>Employee</display-name>
<ejb-name>Employee</ejb-name>
com.ami.amihr.EmployeeHome
com.amc.amchr.Employee
<ejb-class>com.amc.amchr.EmployeeBean</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>Employee</abstract-schema-name>
<cmp-field><field-name>employeeId</field-name></cmp-field>
<cmp-field><field-name>employeeFirstName</field-name></cmp-field>
<cmp-field><field-name>employeeLastName</field-name></cmp-field>
<cmp-field><field-name>employeeEmailId</field-name></cmp-field>
</enterprise-beans>
</ejb-jar>
File : web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<!--
Modification History
********************
-->
<web-app>
<!-- Action Servlet Configuration -->
<ejb-ref>
<ejb-ref-name>ejb/EmployeeEJB</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
com.amb.ambhr.EmployeeHome
com.amc.amchr.Employee
<ejb-link>EmployeeEJB</ejb-link>
</ejb-ref>
</web-app>
Pl help me to sove this problem thanks in advance.