I'm having trouble getting a mapping to work with Hibernate JPA, using Spring. I'll list several code excerpts, and the end of the note has the error message I'm getting.
I have two tables, "student" and "absence". the "absence" table has a composite primary key consisting of all of its columns, and one of those columns is also a foreign key to "student". They are defined somewhat like this in MySQL:
I'm attempting to map these with minimal annotations, specifying the mapping mostly in the orm.xml file.
The two classes, as I've defined them so far, are:
and then my orm.xml file (excerpt) is this, so far:
When I run a simple test, it fails to completely initialize, failing with this:
mappedBy reference an unknown target entity property: jpatest.domain.Absence.student in jpatest.domain.Student.absences
I also see the following warning appear before this failure:
Property jpatest.domain.Absence.student not found in class but described in <mapping-file/>
I'm not sure what I'm doing wrong here, but I'm sure it has something to do with the embedded id.
Besides pointing out what's "wrong", I'd appreciate any ideas of simpler ways to do this, although I'd prefer to continue using the XML descriptor more than annotations.
subject: JPA: Map composite primary key with one field being foreign key