title: org.hibernate.MappingException: collection foreign key mapping has wrong number of columns. Misleading Error details?
body: <p>I have a Relation between a <code>World</code>, a <code>Map</code> and it's <code>Tile</code>s.</p>
  <p>However I receive and error that I do not really understand:</p>
  <pre><code>Caused by: org.hibernate.MappingException: collection foreign key mapping has wrong number of columns: com.barbarus.state.world.Map.tiles type: component[worldId,x,y]
  </code></pre>
  <p>I don't really get what the issue with <code>Map.tiles</code> is there? and why it's describing it with <code>component[worldId,x,y]</code>? As you can see below the ID of a tile is <code>TilePosition</code> that should be defined like <code>[component[mapId,x,y]</code>. So the error messages kinda points out the <code>MutableSet&lt;Tile&gt;</code> but at the same time references the <code>MapPosition</code> class. I do not understand the associating between these two in the context of the error message.</p>
  <p>Here is the definition of the entities:</p>
  <pre><code>@Entity
  class World(
      @Id
      val id: String = UUID.randomUUID().toString(),
      val name: String = &quot;default&quot;,
      @OneToMany(mappedBy = &quot;position.worldId&quot;)
      val maps: MutableSet&lt;Map&gt; = mutableSetOf()
  ) { //... }
  </code></pre>
  <pre><code>@Entity
  open class Map(
      @EmbeddedId
      val position: MapPosition,
      @OneToMany(mappedBy = &quot;position.mapId&quot;)
      val tiles: MutableSet&lt;Tile&gt; = mutableSetOf()
  ) { //... }
  
  @Embeddable
  class MapPosition(
      var worldId: String,
      var x: Long,
      var y: Long
  ) : Serializable { //... }
  </code></pre>
  <pre><code>@Entity
  open class Tile(
      @EmbeddedId
      val position: TilePosition,
      @OneToMany(cascade = [CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH])
      val items: MutableSet&lt;Item&gt; = mutableSetOf()
  ) { //... }
  
  @Embeddable
  class TilePosition(
      var mapId: String,
      var x: Long,
      var y: Long
  ) : Serializable { //... }
  
  </code></pre>