title: How to update properties with Hibernate Panache?
body: <p>I have the following DDL definition:</p>
  <pre><code>@Entity
  data class Interest(
      @JsonIgnore
      @ManyToMany(mappedBy = &quot;interests&quot;)
      var account: List&lt;Account&gt; = listOf(),
      var description: String = &quot;&quot;) : PanacheEntity()
  
  
  @Entity
  data class Account(@field:Id var uuid: UUID? = null,
                     @ManyToOne(fetch = FetchType.LAZY) var gender: Gender? = null,
                     var birthday: Long = 0,
                     @ManyToMany(fetch = FetchType.LAZY, cascade = [CascadeType.PERSIST])
                     @JoinTable(
                         name = &quot;account_interests&quot;,
                         joinColumns = [JoinColumn(name = &quot;account_id&quot;)],
                         inverseJoinColumns = [JoinColumn(name = &quot;interest_id&quot;)]
                     )
                     var interests: List&lt;Interest&gt; = listOf()) : PanacheEntityBase
  </code></pre>
  <p>As you can see on the definition, I use <strong>HIBERNATE ORM WITH PANACHE</strong> and it follows Active Record pattern.
  In addition, I have created <code>AccountRepository</code>:</p>
  <pre><code>@ApplicationScoped
  class AccountRepository : PanacheRepository&lt;Account&gt; {
  
    @Transactional
    fun create(newAcc: Account): Account =
        persist(newAcc).let { newAcc }
  
    fun read(id: UUID): Account? =
        find(&quot;uuid&quot;, id).firstResult()
  
    @Transactional
    fun updateInterests(id: UUID, i: Interests): Int {
      println(i)
      return update(&quot;interests = ?1 where uuid = ?2&quot;, i, id)
    }
  
  }
  
  </code></pre>
  <p>The problem that I have is the method <code>updateInterests</code>. It throws the exception:</p>
  <pre><code>RESTEASY002020: Unhandled asynchronous exception, sending back 500: org.jboss.resteasy.spi.ApplicationException: java.lang.IllegalArgumentException: Parameter value [Interest(account=[], description=Luxury)] did not match expected type [java.util.Collection (n/a)]
  </code></pre>
  <p>The incoming <code>interests</code> payload is:</p>
  <pre><code>[Interest(account=[], description=Luxury), Interest(account=[], description=Travel)]
  </code></pre>
  <p>How to update the property of the Account <code>interests</code> correctly?</p>