Assuming the simple case, the PK is a String. I think there are two things here:
1. When you say, you MUST set the PK in the ejbCreate, how do you do this? By calling the set method for the PK field?
2. The spec says, the PK setter method should not be exposed in the component interface. Now, if we're just writing an abstract setter for PK in the bean class, without exposing this setter in the component interface, is the container going to provide the implementation for this abstract setter method? If yes, how? If no, then how to set the PK in ejbCreate?
To brief you about how this came to my mind: I was just trying a sample EntityBean with
J2EE RI. I exposed the setter for PK in the component interface (forgot what spec said). And in the bean class, provided the abstract setter method of the PK, and from ejbCreate called this abstract setter of the PK.
Now before deploying, when I tried to verify this, it gave me this message (most probably it was warning, not error) - that the setter method of the PK should not be exposed in the component interface.