IBM Support

PH13805: UNIDIRECTIONAL ONETOMANY MAPPING INSERTS WITH MULTIPLE FOREIGN KEY REFERENCES

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

APAR status

  • Closed as program error.

Error description

  • If an entity relationship has a OneToMany mapping with a
    JoinColumn to an existing foreign key mapping, EclipseLink will
    add an additional reference to that column in the INSERT
    statement.
    
    Example:
    
    @Entity
        public class Post {
           @Id private Long id;
           @OneToMany @JoinColumn(name = "POST_FK",
            referencedColumnName = "id", nullable = false)
           private List<Comment> comments;
        }
        @Entity
        public class Comment {
           @Id private Long id;
           @Column(name = "POST_FK", nullable = false)  private long
                          idA;
        }
    
    
    In this example, since "POST_FK" is an existing mapping declared
    in Comment entity, then EclipseLink will add the column to the
    INSERT statement twice. This causes the following exception to
    be thrown:
    
    `java.sql.SQLSyntaxErrorException: Column name 'POST_FK'
    appears more than once times in the column list of an INSERT
    statement.`
    

Local fix

  • N/A
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server - Java Persistence API - JPA 2.1 &   *
    *                  EclipseLink                                 *
    ****************************************************************
    * PROBLEM DESCRIPTION: EclipseLink INSERTs for                 *
    *                      Unidirectional, OneToMany mapping       *
    *                      contain multiple FK references          *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    This is a regression fix for PH02992 that delivered
    Unidirectional, OneToMany relationship support for non-nullable
    FK. Adding that support revealed an existing bug that was not
    previously being encountered with this mapping.
    Example exception:
    ´´´
    Call: INSERT INTO VEHICLE (SALES_ID, AMOUNT, PERCENTAGE,
    VERSION, SALES_ID, TYPE) VALUES (?, ?, ?, ?, ?, ?)
    bind => [74cceb63-46a5-4871-b171-4ecf67fd5fd7, 4789.915966,
    19, 1, 74cceb63-46a5-4871-b171-4ecf67fd5fd7, VAT]
    Caused by org.eclipse.persistence.exceptions.DatabaseException
    :
    Internal Exception: java.sql.SQLSyntaxErrorException:
    ORA-00957: duplicate column name
    ´´´
    

Problem conclusion

Temporary fix

Comments

APAR Information

  • APAR number

    PH13805

  • 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

    2019-06-27

  • Closed date

    2019-11-25

  • Last modified date

    2019-11-25

  • 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



Document information

More support for: WebSphere Application Server
General

Software version: 900

Reference #: PH13805

Modified date: 25 November 2019