Hello,
We have a table where on one column (some id of integer type) we have one-to-one relations. For some records, this column is unassigned, and we store there -1. -1 is our application-level NULL that prevents use of outer join.
Where is the problem? In certain cases, Hibernate executes a query on the source table with ‘-1’ and gets more than one record..which is a violation since of the rule due to 1:1 relation and that column must be unique..
How do we tell Hibernate that ‘-1’ value shall act as NULL and it can be many-to-one for this case? e.g. for all IDs > 1 it is one:one, and for -1 it is many:one?
Is there ‘by-the-book’ solution?
-- Michael
|