Thanks Dharmendra
Unfortunately the nullability of the constraint, which, all along, I had set via the nullable parameter of my JoinColumn annotations, as seen below, does not seem to be the cure.
Code:
@ManyToOne
@JoinColumn(name = "candidate_id", nullable=true )
public Candidate getCandidate() {
return candidate;
}
I used the same annotations for the other Many-To-One constraint Spacer.
The documentation for the PropertyAccessException lists several possible reasons, including
* failure of a security check
* an exception occurring inside the getter or setter method
* a nullable database column was mapped to a primitive-type property
* the Hibernate type was not castable to the property type (or vice-versa)
I cannot see any of these applying in my case however. All Ids are auto-generated (Postgres increment sequence) non-primitive Longs.
The getter in question, persistence.Spacer.getId() does not require any arguments, and why should it.
Code:
@Id @GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() {
return id;
}
So the key must be to figure out why an IllegalArgumentException is occurring when Hibernate calls it.
Might there be a problem with the key generation strategy (GenerationType.AUTO)? This has never made any trouble before and the same Postgres sequence is used for all other DB operations, e.g. the persistence of my Spacer instance in the first step.