title: Hibernate/JPA: could not set a field value by reflection setter
body: <p>My JPA/Hibernate odyssey continues...</p>
  
  <p>I am trying to work around <a href="https://stackoverflow.com/questions/4027623/how-do-i-properly-cascade-save-a-one-to-one-bidirectional-relationship-on-primar">this issue</a>, and so I have had to define primitive @Ids in my class that uses 3 entity fields as a composite key. This seems to get me a bit further, but now I'm getting this when persisting:</p>
  
  <pre><code>javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not set a field value by reflection setter of com.example.model.LanguageSkill.stafferId
  </code></pre>
  
  <p>Here's my composite class:</p>
  
  <pre><code>public class LanguageSkill implements Serializable
  {
      @Id
      @GeneratedValue (strategy = GenerationType.IDENTITY)
      @Column(name = "Staffer_ID")
      private Long stafferId;
  
      @Id
      @ManyToOne(cascade = CascadeType.ALL)
      @MapsId(value = "stafferId")
      private Staffer staffer;
  
      @Id
      @GeneratedValue (strategy = GenerationType.IDENTITY)
      @Column(name = "Language_ID")
      private Long languageId;
  
      @ManyToOne
      @MapsId(value= "languageId")
      private Language language;
  
      @Id
      @GeneratedValue (strategy = GenerationType.IDENTITY)
      @Column(name = "Language_Proficiency_ID")
      private Long languageProficiencyId;
  
      @ManyToOne
      @MapsId(value= "languageProficiencyId")
      private LanguageProficiency languageProficiency;
  }
  </code></pre>
  
  <p>I do have proper getters and setters (IDE-generated) for both the primitives as well as the entities.</p>
  
  <p>Here are my libs. I'm not totally convinced that I'm using a compatible set of persistence libraries (references to a cookbook detailing how to properly mix-and-match these would be highly appreciated.)</p>
  
  <ul>
  <li>Hibernate 3.5.6-SNAPSHOT</li>
  <li>hibernate-jpamodelgen 1.1.0.CR1</li>
  <li>hibernate-validator 3.1.0.GA </li>
  <li>MySQL 5.1.6</li>
  <li>jsr250-api 1.0 </li>
  <li>javax.validation validation-api 1.0.0.GA</li>
  </ul>
  
  <p>Wow, it's frustrating. 3 days now full time trying to solve various issues like this just for basic ORM. I feel defective. :-(</p>