These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Oracle and Empty string in where condition
PostPosted: Tue Sep 05, 2006 3:33 am 
Newbie

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.