I am working with a large, old database and i now try to access it with hibernate instead of SQL. One of the larger Problems with this is the use of "0" and "-1" (meaning "NULL") in foreignKeys without constraints.
I had much of the code generated, but i add the joins manually. Like this
@OneToMany(fetch = FetchType.EAGER)
@JoinColumn(nullable = true, name = "fkActivityId")
public List<Activity> getActivities() {
return activities;
}
The problem is, that as soon as i have an object having fkActivityId = "-1" or "0" meaning NULL, there will be an Exception complaining that such an object can't be found.
Is there a way to make Hibernate behave as if it was NULL?