Support composite primary keys via @EmbeddedId, mapped to an _id sub-document

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Model
    • None
    • 5
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Supported

      Composite primary keys declared with @EmbeddedId (a plain @Embeddable). @Struct on the id embeddable is neither required nor needed.

      The key is stored as the document's _id sub-document, with a stable field order. For an entity keyed on (publisherId, bookNo):

      { "_id": { "publisherId": 1, "bookNo": 1 }, "title": "..." }
      

      Application-assigned only (composite keys are never generated).

      Operations:

      • persist / find / update / delete by id
      • HQL filtering by the whole id (=, in) and by individual id fields
      • selecting the id or an id field
      • order by id
      • bulk update / delete by id

      Associations to a composite-key entity depend on HIBERNATE-164 (compound equijoin ON); end-to-end support to be verified once 164 lands.

      Out of scope

      • @jakarta.persistence.IdClass composite keys

            Assignee:
            Jeffrey Yemin
            Reporter:
            Ajay Tandon
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: