I am mapping my classes with the tables of my database, but when running a test, I get the following error:
Caused by: org.hibernate.AnnotationException: A F
Your class CiudadPK
has two columns in it. You're only using @JoinColumn
which is limited to a single column. You need to use @JoinColumns
and list out both columns in the FK, e.g.
// bi-directional many-to-one association to Provincia
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumns({
@JoinColumn(name = "codProvincia", insertable = false, updatable = false),
@JoinColumn(name = "codRegion", insertable = false, updatable = false)
})
private Provincia provincia;
You'll likely have the other issue w/ Ciudad
as well, please follow the pattern here to correct that one.