-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Exclude values from a column
PostPosted: Sun Mar 29, 2009 9:11 am 
Newbie

Joined: Tue Mar 03, 2009 9:32 am
Posts: 7
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.