You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Nathan Ward <nw...@resqsoft.com> on 2006/04/23 17:16:07 UTC

Handling invalid foreign key references

Hello,
 
I sent this message in the user-java-digest@ibatis.apache.org mailing list
yesterday. I'm not sure if it is actually the same mailing list or not. My
apologies if this is duplicate. I'm don't understand how these mailing lists
work very well yet.
 
How can I handle the case that a foreign key field has an invalid value? I'd
like the software to treat it as if it was null, but I see a way to do this
with iBATIS.
 
Here's some specifics on the situation that I'm dealing with.
 
I'm converting an existing PowerBuilder application to a Java web
application, but we are keeping the existing database (both the schema and
the data). We found that the existing PowerBuilder system often puts space
characters into foreign key fields (foreign keys aren't enforced) when there
no associated record in the referenced table. For example, we have an
"Alert" table that has a wf_trans_id field, where the wf_trans_id field is
nine character field that is the primary key of the WorkflowTransaction
table. An Alert may or may not have an associated WorkflowTransaction. In
which case, we have found that the wf_trans_id field is has nine characters
in it rather than null.
 
   Nathan
 
Nathan Ward
ResQSoft, Inc.
www.resqsoft.com