Hi, I have a situation here where in I am trying to update a field which forms the Composite Primary key through a CMP Entity bean. The problem here is that all other except for this field gets updated. It's not throwing an error either. I tried to print the updated value in the console just after setting it in the Update() method of the Session bean which is calling the Entity Bean Remote Interface. It's showing the updated value but it's not reflecting in the Database. Can someone suggest a solution to this problem. Thanks in advance,
Since the Primary Key - whether simple or composite - essentially "is" the EJB, any attempt to change it is effectively deleting the old EJB and creating a new one. I haven't checked the spec to see if it's explicitly forbidden to change the primary key fields, but from a practical point of view, it's almost certainly safer to actually remove and create. Just make sure that the operation is wrapped in a transaction (for example, done through a session EJB) in order to ensure that the operation is atomic.
An IDE is no substitute for an Intelligent Developer.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Updating a Composite Primary Key in a CMP Entity Bean