IBM Support

PM63882: ORG.APACHE.OPENJPA.PERSISTENCE.INVALIDSTATEEXCEPTION.

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Problem: org.apache.openjpa.persistence.InvalidStateException.
    
    
    Caused by: <openjpa-1.2.2-r422266:898935 nonfatal user error>
    org.apache.openjpa.persistence.InvalidStateException:
    Operation attempted on a deleted instance.
    FailedObject:
    org.apache.openjpa.enhance.provatsp$TestTsp$pcsubclass@3c0b655a
            at
    org.apache.openjpa.kernel.PCState.error(PCState.java:443)
            at
    org.apache.openjpa.kernel.PDeletedState.beforeOptimisticWrite(PD
    eletedState.java:76)
            at
    org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImp
    l.java:1575)
            at
    org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImp
    l.java:1515)
            at
    org.apache.openjpa.util.Proxies.dirty(Proxies.java:66)
            at
    org.apache.openjpa.util.java$sql$Timestamp$proxy.setNanos(Unknow
    n Source)
            at
    org.apache.openjpa.jdbc.sql.DBDictionary.setTimestamp(DBDictiona
    ry.java:1144)
            at
    org.apache.openjpa.jdbc.sql.DBDictionary.setTyped(DBDictionary.j
    ava:1282)
            at
    org.apache.openjpa.jdbc.sql.RowImpl.flush(RowImpl.java:890)
            at
    org.apache.openjpa.jdbc.sql.RowImpl.flush(RowImpl.java:850)
            at
    org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flus
    hAndUpdate(PreparedStatementManagerImpl.java:118)
            at
    org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerI
    mpl.flushAndUpdate(BatchingPreparedStatementManagerImpl.java:82)
            at
    org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flus
    hInternal(PreparedStatementManagerImpl.java:89)
            at
    org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flus
    h(PreparedStatementManagerImpl.java:72)
            at
    org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(Con
    straintUpdateManager.java:543)
            at
    org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(Con
    straintUpdateManager.java:119)
            at
    org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager.f
    lush(BatchingConstraintUpdateManager.java:59)
            at
    org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(Abstr
    actUpdateManager.java:89)
            at
    org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(Abstr
    actUpdateManager.java:72)
            at
    org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreM
    anager.java:721)
            at
    org.apache.openjpa.kernel.DelegatingStoreManager.flush(Delegatin
    gStoreManager.java:130)
            ... 40 more
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server V6.1.0 Feature Pack for Enterprise   *
    *                  JavaBeans 3.0 who make use of the           *
    *                  java.sql.Timestamp as a primary key.        *
    ****************************************************************
    * PROBLEM DESCRIPTION: InvalidStateException deleting an       *
    *                      instance with a Timestamp in its        *
    *                      primary key.                            *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    Attempting to remove an instance that has a java.sql.Timestamp
    field in its primary key results in this error:
    org.apache.openjpa.persistence.InvalidStateException:
    Operation attempted on a deleted instance.
    To describe this issue, take the following database table and
    data, and JPA Entity:
    Take the following table:
    CREATE TABLE test_tsp (
    t Timestamp,
    desc char(30)
    )
    which contains just the following row:
    INSERT INTO test_tsp(T,DESC) VALUES ( CURRENT_TIMESTAMP, 'one')
    The table is mapped to this JPA Entity
    @Entity
    @Table(name="TEST_TSP")
    public class TestTsp implements Serializable {
    @Column(name="T")
    @Id
    private Timestamp idTsp;
    @Column(name="DESC")
    private String desc;
    public TestTsp() {
    super();
    }
    ....
    }
    With the above table, data, and code, an
    'InvalidStateException' occurs if the following code is
    run, which attempts a delete of the row:
    Query query = em.createQuery("select t from TestTsp t where
    t.desc='one'");
    List<TestTsp> list = query.getResultList();
    for (TestTsp t : list) {
    em.remove(t);
    }
    Note that the error doesn't happen if the primary key
    annotation (@Id) is moved on the other field of the entity,
    which is not a timestamp but a char:
    @Column(name="T")
    private Timestamp idTsp;
    @Column(name="DESC")
    @Id
    private String desc;
    

Problem conclusion

  • Code has been added to ensure a java.sql.Timestamp used as a
    primary key can have its coresponding row properly deleted
    from the database.
    
    The fix for this APAR is currently targeted for inclusion
    in Enterprise JavaBeans 3.0 Feature Pack Fix Pack 45
    (6.1.0.45) of WebSphere Application Server version 6.1.
    
    Please refer to the recommended updates page for delivery
    information:
    http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
    

Temporary fix

Comments

APAR Information

  • APAR number

    PM63882

  • Reported component name

    WAS EJB3 FEATUR

  • Reported component ID

    5724J0851

  • Reported release

    610

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2012-05-04

  • Closed date

    2012-05-21

  • Last modified date

    2012-05-21

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

    PM64858 PM64860

Fix information

  • Fixed component name

    WAS EJB3 FEATUR

  • Fixed component ID

    5724J0851

Applicable component levels

  • R610 PSY

       UP

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"6.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
10 February 2022