CMP with Sun app7 problem with primary keys

Discussions

EJB programming & troubleshooting: CMP with Sun app7 problem with primary keys

  1. CMP with Sun app7 problem with primary keys (1 messages)

    I am running a simple, one bean class with CMP on Sun app 7 using Oracle 9.x. I can create a new record and browse it. My findByPrimaryKey works fine as well. However, when I try to update an existin record, I get the following message:

    com.sun.jdo.api.persistence.support.JDOUnsupportedOptionException: Update of a primary key field is not allowed.

    Has anyone seen this? Any and all help is appreciated.

    tia,

    Mike

    Threaded Messages (1)

  2. And it's right[ Go to top ]

    I had work with SunOne AppServ7 when it was realized (in autumn). Then I spend about a month on it (I work with Windows version). And had touched with next problem:
    CMP2.0 findByPrimaryKey does not work properly! This method always return nil. At the other hand, manually created same method with corresponding EJBQL works fine. J2EE RI seems to be more stable.

    After all I study many books like "Bitter Java" and become more realistic towards "fashion words". May be today that problem was fixed, but I choose others.

    Now about Your's problem:

    Sun Microsystems -- Enterprise JavaBeans(tm) Specification, Version 2.1
    (ejb-2_1-prd-spec.pdf -- 3,258,131 bytes)

    10.3.1 The entity bean provider's programming contract
    (and read last but one paragraph, bottom of pafe 144)

    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.

    Big thanks to Java developers,
      I wish them create much more useful PDFs!