Re: .a developer must create an ejbHome<method>
I think you're confusing the content in the EJB Bean class, and the
code in the Home interface. It's create in the home, it's ejb... in the
Bean class.
Here's a few tutorials about BMP and EJB development:
http://www.technicalfacilitation.com/examscam/tf/get.php?link=12bmpentityebeans
Cheers!
-Cameron McKenzie
Free Java Certification Mock Exams: www.scja.com
Free Java and J2EE Tutorials: www.mcnz.com
www.pulpjava.com www.technicalfacilitation.com www.cameronmckenzie.com
package com.examscam.ejb;
/**
* Local Home interface for Enterprise Bean: PersonBMP
*/
public interface PersonBMPLocalHome extends javax.ejb.EJBLocalHome {
/**
* Creates an instance from a key for Entity Bean: PersonBMP
*/
public com.examscam.ejb.PersonBMPLocal create()
throws javax.ejb.CreateException;
/**
* Finds an instance using a key for Entity Bean: PersonBMP
*/
public com.examscam.ejb.PersonBMPLocal findByPrimaryKey(
com.examscam.ejb.PersonBMPKey primaryKey)
throws javax.ejb.FinderException;
}
package com.examscam.ejb;
/**
* Bean implementation class for Enterprise Bean: PersonBMP
*/
public class PersonBMPBean implements javax.ejb.EntityBean {
String name;
int age;
/**
* @return Returns the age.
*/
public int getAge() {
System.out.println("In getAge");
return age;
}
/**
* @param age The age to set.
*/
public void setAge(int age) {
System.out.println("In setAge");
this.age = age;
}
/**
* @return Returns the name.
*/
public String getName() {
System.out.println("In getName");
return name;
}
/**
* @param name The name to set.
*/
public void setName(String name) {
System.out.println("In setName");
this.name = name;
}
private javax.ejb.EntityContext myEntityCtx;
/**
* ejbActivate
*/
public void ejbActivate() {
System.out.println("In ejbActivate");
}
/**
* ejbLoad
*/
public void ejbLoad() {
System.out.println("In ejbLoad");
}
/**
* ejbPassivate
*/
public void ejbPassivate() {
System.out.println("In ejbPassivate");
}
/**
* ejbRemove
*/
public void ejbRemove() throws javax.ejb.RemoveException {
System.out.println("In ejbRemove");
}
/**
* ejbStore
*/
public void ejbStore() {
System.out.println("In ejbStore");
}
/**
* getEntityContext
*/
public javax.ejb.EntityContext getEntityContext() {
System.out.println("In getEntityContext");
return myEntityCtx;
}
/**
* setEntityContext
*/
public void setEntityContext(javax.ejb.EntityContext ctx) {
System.out.println("In setEntityContext");
myEntityCtx = ctx;
}
/**
* unsetEntityContext
*/
public void unsetEntityContext() {
System.out.println("In unsetEntityContext");
myEntityCtx = null;
}
/**
* ejbCreate
*/
public com.examscam.ejb.PersonBMPKey ejbCreate()
throws javax.ejb.CreateException {
System.out.println("In ejbCreate");
return null;
}
/**
* ejbPostCreate
*/
public void ejbPostCreate() throws javax.ejb.CreateException {
System.out.println("In ejbPostCreate");
}
/**
* ejbFindByPrimaryKey
*/
public com.examscam.ejb.PersonBMPKey ejbFindByPrimaryKey(
com.examscam.ejb.PersonBMPKey primaryKey)
throws javax.ejb.FinderException {
System.out.println("In findBy");
return null;
}
Doug Pardee wrote:
EJB home methods are like static methods. They're specific to the
particular EJB class, but not to a particular EJB instance. They were
added in EJB 2.0.
Sun describes them this way (sections 9.5.4 and 9.6.4 of the EJB 2.1
spec):
"Home methods are methods that the Bean Provider supplies for
business logic that is not specific to an entity bean instance."