Joined: Tue Sep 05, 2006 3:12 am Posts: 1
|
Hi to everyone! I'm experiencing a little problem using NHibernate 1.2.0 with Oracle.
I'm using EmptyStringType to fix the emptystring issue but this conflicts with
optimistic-lock="dirty"
setting in the class mapping.
Consider this scenario:
1) a persistent instance of a class has a string property set to string.Empty
2) I modify this property setting a new value (so it becomes dirty and will be checked in the WHERE condition of the subsequent UPDATE query)
3) I Flush the session
What I get is an UPDATE query similar to the following
UPDATE table SET .....
WHERE ID = :p0
AND MyStringColumn = :p1
with p1 parameter set to DBNull.Value. However, this doesn't work because the where condition doesn't return any rows: it should be something like
WHERE ID = :p0
AND MyStringColumn is NULL
but to get this behaviour I should have the string property set to null in step 1 instead of string.Empty.
Consider that I'm working on a legacy DB and Domain and I cannot easily change them. Is there a way to fix the problem? Do I have to build a custom Oracle driver? Or would it be better working with an interceptor?
Thank you in advance.
Marco
|
|