Hi,
I am working with a legacy DB (which I cannot really change) and have a small problem.
I have a table (let's call it tbl_A) and another table (tbl_B) with foreign key column to tbl_A. In tbl_B, the values of the foreign key column can be a valid id from tbl_A or -99 (to indicate some special case).
Of course there isn't really a foreign key constraint on that column, but applicatively we treat it as one.
I need a way to tell the oneToOne relationship to exclude -99 values and regard them as null.
My mapping for the column in tbl_B is:
@OneToOne
@JoinColumn(name = "tbl_A_id")
tbl_A_type a_property;
So, how can I exclude the -99 values from the oneToOne association? Formula? User-types?
Many thanks to the good-hearted soul who helps me in this matter, Uri.
_________________ Regards,
Uri Bar
|