The following is a quick checklist of “gotchas” to help you with your implementation:
Primary keys must be immutable. In other words, it is not possible to change the value of a primary key for an entity once assigned (see EJB specification, section 10.3.5).
Of course, there is nothing to prevent you from directly changing the data in the underlying persistent data store (for example, with an SQL UPDATE statement). But you will need to do this with the EJB container offline or otherwise at rest.
Sometimes, Entity beans interact with non-data store resources. An example might be a client java.net.Socket or perhaps a subscription to a JMS topic (covered more on Days 9, “Java Messaging Service,” and Day 10, “Message-Driven Beans”). These resources ...