My JPA / Hibernate Odyssey Continues ...
I am trying to get around this problem and therefore I had to define primitive @Ids in my class that uses 3 entity fields as a composite key. It seems to me a little more, but now I get it when I persist:
javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not set a field value by reflection setter of com.example.model.LanguageSkill.stafferId
Here is my composite class:
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;
}
I have the correct getters and setters (generated by the IDE) for both primitives and entities.
Here are my libraries. I'm not quite sure that I am using a compatible set of persistence libraries (a reference to cooking, which details how to mix and match them correctly, would be highly appreciated.)
- Hibernate 3.5.6-SNAPSHOT
- hibernate-jpamodelgen 1.1.0.CR1
- hibernate-validator 3.1.0.GA
- MySQL 5.1.6
- jsr250-api 1.0
- javax.validation validation-api 1.0.0.GA
, . 3 , , ORM. .: - (