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

[1188 byte] By [tomclose] at [2007-9-26 4:57:24]
# 1
If you say that username is null in your System.outwe need to see what happens before this is called.Could you send in more of the cod please.
Bnarva at 2007-6-29 18:52:11 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...