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


    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.3.0
    • Component/s: jdbc
    • Labels:


      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 <> 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.


        Michael Dick made changes -
        Fix Version/s 1.2.0 [ 12313102 ]
        Fix Version/s 1.3.0 [ 12313326 ]
        Patrick Linskey made changes -
        Field Original Value New Value
        Fix Version/s 1.1.0 [ 12312344 ]
        Fix Version/s 1.2.0 [ 12313102 ]
        Michael Vorburger created issue -


          • Assignee:
            Michael Vorburger
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: