Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a hibernate mapping over a legacy DB2 database. A particular table has a foreign key to another table. This column is populated with spaces instead of null when there is no association to the other table. I have a many to one associate to the second table. The issue is for every row that has spaces in the foreign key field an SQL is executed against the database as there is no value in the cache for it. Is there a way to ignore fields populated with spaces in the join so requests are not issued to the database?

share|improve this question

1 Answer 1

Why not simply add this condition to the WHERE clause (not the join condition)?

 WHERE THE_COLUMN <> ' ' AND ...
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.