title: Are composite primary keys in JPA with Quarkus possible?
body: <p><strong>How to JPA-declare a composite key with Quarkus?</strong></p>
  
  <p>Trying to use multiple <code>@Id</code> annotations in an <code>@Entity</code> class with Quarkus, results in the error:  </p>
  
  <pre><code>Currently the @Id annotation can only be placed on a single field or method. Offending class is abc.model.Property
      at io.quarkus.spring.data.deployment.generate.StockMethodsAdder.getIdAnnotationTargetRec(StockMethodsAdder.java:940)
  </code></pre>
  
  <p>But first, after declaring  </p>
  
  <pre><code>interface PropertyRepository : CrudRepository&lt;Property, Pair&lt;String, abc.model.Entity&gt;&gt;
  </code></pre>
  
  <p>Without the declaration above, there are no complaints, but no possibility to actively manage instances of <code>Property</code>.</p>
  
  <p><strong>How to circumvent this error?</strong></p>
  
  <p>I'm dealing with two JPA Entities:<br>
  1. the first one named <code>Entity</code> (don't mistake for the annotation)<br>
  2. the second one named <code>Property</code></p>
  
  <p>An <code>Entity</code> can have 0..n instances of <code>Property</code>. The code is as follows:</p>
  
  <pre><code>@Entity
  data class Entity (
          @Id
          @Column(name = "entity_id", updatable = false)
          var entityId: String? = null,
  
          @Column(nullable = true)
          var type: String? = null
  ) {
      @OneToMany(mappedBy = "entity")
      var properties: List&lt;Property&gt;? = null
  }
  </code></pre>
  
  <pre><code>@Entity
  data class Property (
          @Id
          @Column(name = "type")
          var type: String? = null,
  
          @Id
          @ManyToOne
          @JoinColumn(name = "entity_id")
          private var entity: abc.model.Entity? = null
  ) : Serializable
  </code></pre>
  
  <hr>
  
  <p>Declaring the composite primary key as an <code>@EmbeddedId</code> as follows, does not solve the problem, as Quarkus currently doesn't allow other annotations than <code>@Id</code> in this case:</p>
  
  <pre><code>@Entity
  data class Entity (
          @Id
          @Column(name = "entity_id", updatable = false)
          var entityId: String? = null,
  
          @Column(nullable = true)
          var type: String? = null
  ) {
      @OneToMany(mappedBy = "propertyId.entityId")
      var properties: List&lt;Property&gt;? = null
  }
  
  interface PropertyRepository : CrudRepository&lt;Property, PropertyId&gt;
  
  @Embeddable
  data class PropertyId (
          var type: String? = null,
  
          @Column(name = "entity_id")
          private var entityId: String? = null
  ) : Serializable
  
  @Entity
  data class Property (
          @EmbeddedId
          var propertyId: PropertyId? = null,
  
          @Column(name = "constant_value")
          var constantValue: String? = null
  )
  </code></pre>
  
  <pre><code>java.lang.IllegalArgumentException: Currently only Entities with the @Id annotation are supported. Offending class is abc.model.Property
      at io.quarkus.spring.data.deployment.generate.StockMethodsAdder.getIdAnnotationTargetRec(StockMethodsAdder.java:932)
  </code></pre>