glassfish
  1. glassfish
  2. GLASSFISH-1819

Serious limitation on entity relationships w/ composite keys

    Details

    • Issuezilla Id:
      1,819

      Description

      Apparently the Java EE spec doesn't completely specify how relationships between
      entities that have composite primary and foreign keys should be handled.

      In Glassfish using Toplink, if there are two entities that both have composite
      primary keys and they do not match perfectly, they cannot be joined together
      in a @OneToMany or @ManyToOne relationship without throwing an exception.

      For example, if entityA has a composite key made up of three fields, e.g. key1,
      key2, key3....and entityB has as composite PK w/ two fields, key1 and key2 - a
      @OneToMany with @JoinColumns(

      {@JoinColumn(...), @JoinColumn(...)}

      ) always
      results in a oracle.toplink.essentials.exceptions.ValidationException.

      I would provide an use-case but apparently this issue is already well
      known...and code snippets & examples, plus detailed explanations can all be
      found on this post in the GF forums:

      http://forums.java.net/jive/thread.jspa?forumID=56&threadID=20604

      This issue of legacy data that has tables w/ multiple (sometimes unmatched)
      primary and foreign keys is quite common. Hibernate handles this scenario
      without a problem...so it only stands to reason that Toplink should also be able
      to handle it.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            tware
            Reporter:
            zambizzi
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: