IBM Support

PM62949: Binding Query parameter fails validation for Externalized field.

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • While using EJB 3.0 (which uses openJPA 1.0.4 internal) known
    externalization failure
    

Local fix

  • <NONE>
    

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           *
    *                  OpenJPA Externalizer annotation.            *
    ****************************************************************
    * PROBLEM DESCRIPTION: Binding Query parameter fails           *
    *                      validation for Externalized field.      *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    OpenJPA supports a field f of declared type <T> be persisted
    in database corresponding to a different type <S> when f
    specifies a two-way transformation between <S> and <T>. For
    example, a field f can be declared as java.net.URL but stored
    in database as String (i.e. VARCHAR).
    Now the question is:
    When an 'externalized' field f occurs in query predicate
    and is bound by a parameter p what should be the runtime type
    of p?
    The documentation [1] says p can be of either <T> or <S>.
    But the code breaks during parameter validation if Class(p) =
    <T> and with data conversion error if Class(p) = <S>
    To follow is an examle of the issue described:
    1. Declare a persistent field f of type java.util.UUID
    externalized to java.lang.String with a pair of transformer
    functions
    @Persistent
    @Externalizer("toString")
    @Factory("UUID.fromString")
    private UUID uuid;
    2. Use the field f in a Query with a binding parameter:
    String jpql = "SELECT p FROM ExternalValues p WHERE
    p.uuid=:uuid";
    Query query = em.createQuery(jpql);
    3. Try to set parameter on the query:
    //parameter type equals declared type of f
    a) query.setParameter("uuid", new UUID(1,2));
    or
    // parameter type equals externalized type of f
    b) query.setParameter(1, new UUID(1,2).toString());
    4. Either of step 3a or 3b will result in a runtime exception
    [1]
    http://openjpa.apache.org/docs/latest/manual/manual.html#ref_gui
    de_pc_extern
    

Problem conclusion

  • Code had been added to properly handle fields which use the
    OpenJPA Externalizer annotation.
    
    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

    PM62949

  • Reported component name

    WEBSPHERE APP S

  • Reported component ID

    5724J0800

  • Reported release

    610

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2012-04-21

  • 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:

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