Deleting composite-elements with nullable properties generates wrong SQL

1 view
Skip to first unread message

cremor

unread,
Oct 29, 2010, 2:56:03 AM10/29/10
to nhusers
Similar to the problem described in my other request (here:
http://groups.google.com/group/nhusers/browse_thread/thread/7d3d36a22e1de789),
I now have the problem that deleting a composite-element in a set
fails because NHibernate creates a statement where columns are
compared to NULL with the "=" operator.

I'm using NHibernate 3.0.0.Beta1, the Oracle10g dialect with the ODAC
11.2.0.1.2 driver on a 2.0.1.0 DB.

The generated SQL is the following:

DELETE
FROM
WORKFLOWBEDINGUNGEN
WHERE
WOF_ID = :p0
AND BEDINGUNGSFELD = :p1
AND WERT1 = :p2
AND WERT2 = :p3
AND BEDINGUNG = :p4
AND WOF_CODE = :p5;
:p0 = 154 [Type: Int64 (0)], :p1 = NULL [Type: String (0)], :p2 =
NULL [Type: String (0)], :p3 = NULL [Type: String (0)], :p4 = 'NICHT
LEER' [Type: String (0)], :p5 = 3 [Type: Int32 (0)]

The columns WERT1 and WERT2 are nullable VARCHAR2 this time, as well
as BEDINGUNGSFELD.
This statement doesn't fail with an exception, but it just does
nothing because "NULL = NULL" doesn't work.

Even if NHibernate doesn't support the Clob problem of my other
request, this should work at least, shouldn't it?

Btw, for anyone who doesn't know it, an empty string is NULL in
Oracle. So any time you insert an empty string in a table, it will be
NULL.
Reply all
Reply to author
Forward
0 new messages