title: Hibernate referenced @MapKey
body: <p>Is it possible to map an map collection, which use key from referenced table?
  Its hard for explaining, so here is an example of what I want to accomplish. I want to have map in Type entity from language code (String) to TypeLang entity.</p>
  
  <pre><code>@Entity
  public class Type {
      @OneToMany(mappedBy = "type")
      @MapKeyJoinColumn(name = "language.code")
      private Map&lt;String, TypeLang&gt; langMap;
  }
  
  @Entity
  public class TypeLang {
      @ManyToOne
      @JoinColumn(name = "type_id")
      private Type type;
  
      @ManyToOne
      @JoinColumn(name = "lang_code")
      private Language language;
  }
  
  @Entity
  public class Language {
      @Id
      @Column(name = "code")
      @GeneratedValue
      private String code;
  }
  </code></pre>