IBM Support

PH20729: ATTRIBUTEOVERRIDE FOR COMPLEX EMBEDDABLE MAPPINGS ON ECLIPSELINK FAILS

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Attempting to use an @AttributeOverride annotation on an
    @Embedded object, where the attribute overriding name matches
    the ID attribute name, causes EclipseLink to throw an exception.
    
    Example Exception:
    
    Exception Description: The attribute [value] of class
    [model.OverrideEmbeddableA] is mapped to a primary key column in
    the database. Updates are not allowed.
    
       at
    org.eclipse.persistence.exceptions.ValidationException.primaryKe
    yUpdateDisallowed(ValidationException.java:2551)
    
       at
    org.eclipse.persistence.mappings.foundation.AbstractDirectMappin
    g.writeFromObjectIntoRowWithChangeRecord(AbstractDirectMapping.j
    ava:1265)
    
       at
    org.eclipse.persistence.internal.descriptors.ObjectBuilder.build
    RowWithChangeSet(ObjectBuilder.java:1677)
    
       at
    org.eclipse.persistence.mappings.AggregateObjectMapping.writeToR
    owFromAggregateWithChangeRecord(AggregateObjectMapping.java:647)
    
       at
    org.eclipse.persistence.mappings.AggregateObjectMapping.writeFro
    mObjectIntoRowWithChangeRecord(AggregateObjectMapping.java:2131)
    
       at
    org.eclipse.persistence.internal.descriptors.ObjectBuilder.build
    RowForUpdateWithChangeSet(ObjectBuilder.java:1774)
    
       at
    org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.
    updateObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:10
    30)
    
       at
    org.eclipse.persistence.queries.UpdateObjectQuery.executeCommitW
    ithChangeSet(UpdateObjectQuery.java:84)
    
       at
    org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.
    executeWriteWithChangeSet(DatabaseQueryMechanism.java:301)
    
       at
    org.eclipse.persistence.queries.WriteObjectQuery.executeDatabase
    Query(WriteObjectQuery.java:58)
    
       at
    org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQu
    ery.java:908)
    

Local fix

  • na
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server - Java Persistence API - JPA 2.1 &   *
    *                  EclipseLink                                 *
    ****************************************************************
    * PROBLEM DESCRIPTION: EclipseLink throws Exception on         *
    *                      Embedded Class if @AttributeOverride    *
    *                      column name is equal to the @ID column  *
    *                      name                                    *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    If the Entity class has an @ID field with the same name as the
    field in an Embeddable class, EclipseLink will throw an
    exception when updating the Embeddable value. Using
    @AttributeOverride does not change the column value and
    EclipseLink still confuses the column name with the PK name.
    Example exception:
    ´´´
    org.eclipse.persistence.exceptions.ValidationException:
    Exception Description: The attribute [value] of class
    [foo.bar.OverrideEmbeddable] is mapped to
    a primary key column in the database. Updates are not allowed.
    ´´´
    Classes:
    ´´´
    @Entity
    public class OverrideEntityA {
    @EmbeddedId
    private OverrideEmbeddableId id;
    @Embedded
    @AttributeOverrides({
    @AttributeOverride(name = "value", column =
    @Column(name = "OVERRIDE_VALUE")),
    @AttributeOverride(name = "nestedValue.nestedValue",
    column = @Column(name = "OVERRIDE_NESTED_VALUE")) })
    private OverrideEmbeddable id2;
    }
    ´´´
    ´´´
    @Embeddable
    public class OverrideEmbeddable {
    @Column(name = "VALUE")
    private Integer value;
    }
    ´´´
    ´´´
    @Embeddable
    public class OverrideEmbeddableId {
    @Column(name = "VALUE")
    private Integer value;
    }
    ´´´
    

Problem conclusion

Temporary fix

Comments

APAR Information

  • APAR number

    PH20729

  • 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

    2020-01-07

  • Closed date

    2020-02-03

  • Last modified date

    2020-02-03

  • 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