IBM Support

PM70227: 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.
    
    
    org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImp
    l.java:2
    
    109)
     at
    org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1956)
     at
    org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1
    854)
     at
    org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl
    .java:17
    72)
     at
    com.ibm.ws.uow.ComponentContextSynchronizationWrapper.beforeComp
    letion(C
    omponentContextSynchronizationWrapper.java:66)
    .
    .
    .
    Caused by:
    <openjpa-1.0.5-SNAPSHOT-r420667:1227246M:PMR63203TestFix
    nonfatal user error>
    org.apache.openjpa.persistence.InvalidStateException: Es wurde
    versucht,
    eine Operation f&#65409;r eine gel&#65428;schte Instanz auszuf&#65409;hren.
    FailedObject:
    de.saltsolutions.jpaworkshop.entity.Customer-customerId
     at org.apache.openjpa.kernel.PCState.error(PCState.java:443)
     at
    org.apache.openjpa.kernel.PDeletedState.beforeOptimisticWrite(PD
    eletedSt
    
    ..............
    
    .........
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server V7.0.0, V8.0.0, and V8.5.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 Service Levels (Fix Packs) 7.0.0.25, 8.0.0.5, and
    8.5.0.1 of WebSphere Application Server versions 7.0.0,
    8.0.0, and 8.5.0.
    
    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

    PM70227

  • Reported component name

    LIBERTY PROFILE

  • Reported component ID

    5724J0814

  • Reported release

    850

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2012-08-03

  • Closed date

    2012-08-03

  • Last modified date

    2012-08-03

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

    PM64858

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

Fix information

  • Fixed component name

    LIBERTY PROFILE

  • Fixed component ID

    5724J0814

Applicable component levels

  • R850 PSY

       UP

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

Document Information

Modified date:
29 October 2021