NULL primary key when ejbLoad() is called
Hi,
Please help me out here as I am going crazy. The following code is my ejbLoad() method, username is the primary key of the class. My problem occurs when I call the findByPrimaryKey(String username) method on my home interface. ejbFindByPrimaryKey(String username) finds the record in the database fine but after that container invokes the ejbLoad() which then throws a NoSuchEntityException.
When I print out the primary key (username) just before the database query, it says that it is NULL. This is my first application so perhaps there is something fundamental, which I am not getting but I thought that the primary key would be initiated by the container after it calls ejbFindByPrimaryKey and the constructor.
public void ejbLoad() {
boolean found = false;
try {
System.out.println(this.username);
found = loadRow();
} catch (Exception e) {
throw new EJBException("ejbLoad -" + e.toString()+ ": "+ e.getMessage());
}
if (!found)
throw new NoSuchEntityException("No data for specified primary key");
}
Any ideas will be most welcome,
thanks
Tom

