Alex Rivera | Logout

Hibernate handle long 0 value instead of NULL in ManyToOne relations

Asked 2011-11-07T15:40:43.710
9

I use Hibernate to access to a legacy DB. For some tables the parent-child reference integrity is not enforced, and the long 0 value is used instead of NULL for some "parent" columns in child tables to denote "no parent".

I still want to use these relations in @ManyToOne and @OneToMany fields, but get EntityNotFound error since the 0 value does not correspond to any record in master table.

What are my options?

Edit
Report

1 Answer

9
answered 2011-11-07T16:09:51.357

Your Answer