IBM Support

PI97945: ECLIPSELINK JPA PROVIDER DOES NOT UPDATE VERSON COLUMN AS A BULK UPDATE PARAMETER

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • A bulk update query is expected to be able to update the
    version column as a parameter (JPA 2.1 Spec section 4.10), but
    the query parameter's value is ignored and instead a provider
    generated value is used.
    

Local fix

  • rename the field from "updatetimestamp" to "version", then it
    actually works as expected
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server Liberty - Java Persistence APA -     *
    *                  JPA 2.1 & EclipseLink                       *
    ****************************************************************
    * PROBLEM DESCRIPTION: EclipseLink does not update the         *
    *                      version column value for specific       *
    *                      parameter names. This only occurs       *
    *                      when executing in batch.                *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    The following sample code demonstrates how an application
    would encounter this exception:
    @Entity
    public class TemporalVersionedEntity {
    @Id private long id;
    @Version private java.sql.Timestamp updatetimestamp;
    ...
    }
    Test:
    private final static String qStr1 = "UPDATE
    TemporalVersionedEntity SET updatetimestamp = ?3 " +
    "WHERE id = ?1 AND updatetimestamp = ?2";
    em.getTransaction().begin();
    final Query q = em.createQuery(qStr1);
    q.setParameter(1, theId);
    q.setParameter(2, theOldTimestamp);
    q.setParameter(3, new
    java.sql.Timestamp(System.currentTimeMillis());
    final int count = q.executeUpdate();
    In this test scenario, the UPDATE block that targets the
    version field is ignored, and instead replaces the Parameter
    with a Constant (generated at the time the query is generated,
    which then gets cached and fouls up successive executions of
    the same query once it gets into the query cache, too.) When
    this happens, the parameter passed into the query is ignored.
    

Problem conclusion

Temporary fix

Comments

APAR Information

  • APAR number

    PI97945

  • Reported component name

    WEBS APP SERV N

  • Reported component ID

    5724H8800

  • Reported release

    900

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2018-05-14

  • Closed date

    2018-08-06

  • Last modified date

    2018-08-06

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

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

Fix information

  • Fixed component name

    WEBS APP SERV N

  • Fixed component ID

    5724H8800

Applicable component levels

  • R900 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":"9.0","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
02 November 2021