package org.mockejb.test.entity;
import java.util.*;
import javax.ejb.*;
public class PersonBMPBean implements EntityBean {
private EntityContext context = null;
private long id;
private String firstName;
private String lastName;
private static long idSequence=0;
public synchronized static long generateId(){
return idSequence++;
}
public long ejbCreate( String firstName, String lastName ){
setFirstName( firstName );
setLastName( lastName );
id=generateId();
return id;
}
public void ejbPostCreate( String firstName, String lastName ){
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public long ejbFindByName( String firstName, String lastName ){
return 1;
}
public Collection ejbFindByFirstName( String firstName ) {
Collection pks = new ArrayList();
pks.add( new Long(1));
return pks;
}
public void setEntityContext(EntityContext c) {
context = c;
}
public void unsetEntityContext() {
context = null;
}
public void ejbRemove() throws RemoveException { }
public void ejbActivate() { }
public void ejbPassivate() { }
public void ejbStore() { }
public void ejbLoad() {
System.out.println("Inside ejbLoad");
id = ((Long) context.getPrimaryKey()).longValue();
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}