So in MySQL, NULL != NULL. So if you write a query like the following:
SELECT id, city, last_updated, street_address, zipcode, state_id FROM addresses WHERE street_address = null
You will get 0 rows, even if you have a column where street_address is null.
EclipseLink is generating this SQL:
[EL Fine]: 2014-01-27 18:07:38.388--ServerSession(2079453576)--Connection(1753616363)--Thread(Thread[Default JMS Resource Adapter-worker- - 3,5,main])--SELECT id, city, last_updated, street_address, zipcode, state_id FROM addresses WHERE (street_address = ?)
bind => [null]
Which will never match anything. How do I get EclipseLink to use: is null
rather than = null
?
EDIT:
Thank you for the answers, but if you read my question, I already know about querying for IS NULL
... But my queries don't always query for null. I'm asking how do you get EclipseLink to generate that SQL automatically? For instance, if I have a named query, and I set a parameter to null, how do I get EclipseLink to generate IS NULL
not = NULL