How can I update the primary key field in a CMP Entity Bean?

Tim Duggan

You cannot change the primary key field of an Entity bean. Refer to page 130 of the EJB 2.0 specification, it states "Once the primary key for an entity bean has been set, the Bean Provider must not attempt to change it by use of set accessor methods on the primary key cmp-fields. The Bean provider should therefore not expose the set accessor methods for the primary key cmp-fields in the component interface of the entity bean."
A work around to update a primary key field, would be to remove and then an re-create the bean.