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.  [ 2 posts ] 
Author Message
 Post subject: HELP- Oracle, Char column and optimistic lock (dirty)
PostPosted: Thu Apr 17, 2008 6:46 pm 
Newbie

Joined: Tue Apr 08, 2008 6:24 am
Posts: 8
PLEASE Can someone please help me? I'm desperate!!!!!

NHibernate keeps returning 0 row count on an updated when I have done a previos update.

There is a oracle char(60) column in my database called in_callers_adr

The first update sql is as follows:

Replace '_' with a space.

UPDATE in_cidents SET in_callers_adr = :p0 WHERE in_ref = :p1 AND in_callers_adr=:p2

:p0 - 'EX TEL Aas'
:p1 - 432699
:p2 - 'EX TEL A______________________________'

Then the second is:

UPDATE in_cidents SET in_callers_adr = :p0 WHERE in_ref = :p1 AND in_callers_adr=:p2

:p0 - 'EX TEL A'
:p1 - 432699
p2: - 'EX TEL Aas'

which fails because I'm assuming the where clause needs to contain a padded version of the current value e.g.

:p2 = 'EX TEL Aas___________________________'

Do I need to write a usertype or something

HELP[quote][/quote]


Top
 Profile  
 
 Post subject: SQL hack
PostPosted: Fri Apr 18, 2008 8:09 am 
Newbie

Joined: Tue Apr 08, 2008 6:24 am
Posts: 8
Futher to my issue I have looked at the nhibernate code.

I couldn't see see anyway to change the way it generates the column names in the where clause via its extendibility architecture (e.g. dialect or driver).

Therefore on the oracle client driver I override the generatecommand method on the oracle driver and directly hack the sql generated to use a where .... AND rtrim(columnname)=:p0 .... etc

This is nasty, but it fixes the issue of nhibernate not finding a row to update.

Is there not any other way to do this?


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

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.