Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-593

Embedded element/key/value types should not be limited to simple fields and direct relations to other persistent types, but allow embedded Collections

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.1.0
    • 1.3.0
    • jdbc
    • None

    Description

      It's a pitty that @PersistentCollection(elementEmbedded = true) only works to to "depth 1", that is you can apparently not have an @Entity class A

      { @PersistentCollection(elementEmbedded=true) private Set<B> bs = new HashSet<B>(); ... }

      with @Entity class B again a

      { @PersistentCollection(elementEmbedded=true) private Set<C> bs = new HashSet<C>(); ... }

      .

      On OpenJPA 1.1, this leads to the error: "org.apache.openjpa.util.MetaDataException: "X.y<element:class Y>" is mapped as embedded, but embedded field "..." is not embeddable. Embedded element/key/value types are limited to simple fields and direct relations to other persistent types."

      The expected outcome would to have a schema with an SQL table A, an A_B (that works already!), and an A_B_C table (that doesn't work).

      JPA 2.0 JSR 317 <http://jcp.org/en/jsr/detail?id=317> says "... support for collections of embedded objects, multiple levels of embedded objects ..." so may this will be supported 'soon-ish' (that one liner may not refer to this exact use case)?

      PS: This limitation has unfortunately turned into a show stopper for our use of OpenJPA, and made us look at another ORM which seems to support this kind of mapping.

      Attachments

        Activity

          People

            Unassigned Unassigned
            vorburger Michael Vorburger
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: