OpenJPA
  1. OpenJPA
  2. OPENJPA-1072

Nested embeddable with a relationship to an Entity with a generated id doesn't persist the relationship

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M2
    • Fix Version/s: 2.0.0-M2
    • Component/s: jpa
    • Labels:
      None

      Description

      When working with embeddables I found that if I define a unidirectional @ManyToOne relationship from an embeddable to an Entity which has a generated id, the relationship in the join table doesn't get persisted. I'll attach a zip with my code, but I'll also try to describe the scenario here.

      Entities:
      Seller - Has an auto generated ID and a name
      Book - Has an id(isbn) and an ElementCollection of Listings
      Listing - An embeddable that has a ManyToOne relationship to Seller, a price and comments.

      The scenario is as follows:

      • Create all the sellers.
      • Create a book.
      • Add a listing to each book. Each listing takes a Seller Entity and a price.
      • When I commit the book, the seller_id column in my Listing join table is always zero.

        Activity

        Rick Curtis created issue -
        Hide
        Rick Curtis added a comment -

        Attaching recreate.

        Show
        Rick Curtis added a comment - Attaching recreate.
        Rick Curtis made changes -
        Field Original Value New Value
        Attachment jpa.embeddables.zip [ 12407549 ]
        Fay Wang made changes -
        Assignee Fay Wang [ faywang ]
        Fay Wang made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0.0 [ 12313483 ]
        Resolution Fixed [ 1 ]
        Donald Woods made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Fay Wang
            Reporter:
            Rick Curtis
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development