Embedding BsonArray and BsonDocument in arbitrary way

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      After we have finished simple embedding of both BsonArray and BsonDocument (only one embedding level required), now this ticket will achieve the goal of arbitrary levels and/or structure (mixing both, e.g. array of STRUCT or STRUCT include an array field).

      E.g. given the following entity class:

      @Entity
      @Table(name = "movies")
      static class Movie {
          @Id
          int id;
      
          String title;
      
          TagsByAuthor[] tagsByAuthorList;
      }
      
      @Embeddable
      @Struct(name = "TagsByAuthor")
      static class TagsByAuthor {
      
          @Column(name = "commenter")
          String author;
      
          List<String> tags;
      
      } 

      it should work as expected for both persisting and loading.

      The gist of this ticket is to allow for some recursive embedding code logic covering both array and STRUCT.

      PoC testing case is at https://github.com/NathanQingyangXu/jpa-mongodb-mapping/blob/main/chameleon-core/src/test/java/org/hibernate/omm/type/struct/StructTests.java

      PoC PR is at https://github.com/NathanQingyangXu/jpa-mongodb-mapping/pull/40

            Assignee:
            Valentin Kavalenka
            Reporter:
            Nathan Xu
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: