title: JPA2 JoinColumns JoinColumn name is not being respected. (Hibernate 3.6 and H2)
body: <p>Here is the reduced snippet, omitting the IdClass details. The issue I am having is the tables definition is:</p>
  
  <pre><code>ClientPersonalityModel
  (
   client_id int not null,
   personality_trait_id int not null,
   personality_type_id int not null,
   primary key (client_id, personality_trait_id, personality_type_id)
  )
  </code></pre>
  
  <p>And the class is:</p>
  
  <pre><code>@Entity
  public class ClientPersonalityModel
  {
      @Id 
      @ManyToOne
      @JoinColumn(name="client_id")
      protected ClientModel client;
  
      @Id
      @ManyToOne
      @JoinColumns({
          @JoinColumn(name="personality_trait_id",referencedColumnName="id"),
          @JoinColumn(name="personality_type_id",referencedColumnName="personality_type_id")
      })
      protected ClientPersonalityTraitModel trait;
  }
  </code></pre>
  
  <p>But the persistence framework is trying to use columns CLIENT_ID, TRAIT_ID, TRAIT_PERSONALITY_TYPE_ID.</p>
  
  <p>Why are the @JoinColumn names being ignored?</p>
  
  <p>It throws an exception:</p>
  
  <p>Initial sessionFactory creationfailed.org.hibernate.MappingException: Unable to find logical column name from physical name personality_type_id in table client_personalities</p>
  
  <p>java.lang.ExceptionInInitializerError
  Caused by: org.hibernate.MappingException: Unable to find logical column name from physical name personality_type_id in table client_personalities</p>
  
  <p>This case is covered in many examples, but without overriding the column names.</p>
  
  <p>Ex: </p>
  
  <p>Listing 10-12. Project with Dependent Identifier</p>
  
  <pre><code>@Entity
  @IdClass(ProjectId.class)
  public class Project {
      @Id private String name;
      @Id
      @ManyToOne
      private Department dept;
      // ...
  }
  </code></pre>
  
  <p>from Pro JPA 2 (ISBNs 978-1-4302-1956-9 / 978-1-4302-1957-6)</p>