-->
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.  [ 6 posts ] 
Author Message
 Post subject: Oracle and CLOBs
PostPosted: Wed Mar 28, 2007 12:36 pm 
Regular
Regular

Joined: Fri Jan 27, 2006 2:32 pm
Posts: 102
Location: California, USA
Versions:
NHibernate 1.2.0 Beta 3,
Oracle 9.2.0.5,
.Net 2.0

I have an oracle table with a CLOB column.

Trying to save data to this column gives errors. This issue is similar, if not the same, as report on JIRA:

http://jira.nhibernate.org/browse/NH-465


Anyways. I believe I have found the problem. I created a separate debugging project that just uses ADO.NET and Oracle (no nHibernate), the oracle parameter that gets created for the CLOB column is `OracleType.VarChar`. The insert works when using that type.

However, when nHibernate creates the parameter, it uses `OracleType.NVarChar`. This I believe is what is causing the problem. If in my debugging project I change the type to `OracleType.NVarChar`, then it too will throw the Oracle exception.

Sooooo, I think I found the problem.

But I'm not quite to a solution. I'm digging into nHibernate to find out where the OracleType is derived. It seems as if it is "automatic" and it isn't specifcally set anywhere.


Does anyone have any pointers on where the command parameters are created and if I can somehow create either a UserType or a new Dialect to force using VarChar instead of NVarChar.


My oracle database does not need any non-english text so I believe it does not need NVarChar.

Thanks for any help...
Brian


Top
 Profile  
 
 Post subject: AnsiString
PostPosted: Wed Mar 28, 2007 1:23 pm 
Regular
Regular

Joined: Fri Jan 27, 2006 2:32 pm
Posts: 102
Location: California, USA
I noticed in my debug project, that the DbType is AnsiString. So, I thought I would try to use `AnsiSTringSqlType` in my mapping.

But somehow in doing that, when the parameter gets created, it is trying to use DbType.Binary. That changes the OracleType to `Raw`.

So, maybe something in the driver / dialect isn't using AnsiString properly?


The update/insert command works, but the data is in binary. At least that makes sense. So, now I'm looking to see if I can figure out why NHibernate or my driver or my dialect are turning AnsiString into Binary.


Top
 Profile  
 
 Post subject: Re: AnsiString
PostPosted: Wed Mar 28, 2007 1:49 pm 
Regular
Regular

Joined: Fri Jan 27, 2006 2:32 pm
Posts: 102
Location: California, USA
pelton wrote:
I noticed in my debug project, that the DbType is AnsiString. So, I thought I would try to use `AnsiSTringSqlType` in my mapping.


I think I was using the wrong type. AnsiStringSqlType is in the SqlType namespace.

So I found AnsiStringType in the Type namespace, but it doesn't have any public constructors.

How can I use AnsiStringType? I think this is what I need.


Top
 Profile  
 
 Post subject: Re: AnsiString
PostPosted: Wed Mar 28, 2007 2:02 pm 
Regular
Regular

Joined: Fri Jan 27, 2006 2:32 pm
Posts: 102
Location: California, USA
pelton wrote:
So I found AnsiStringType in the Type namespace, but it doesn't have any public constructors.


Well I changed the internal parameterless constructor to public, and it seems to work now. I was able to insert a strings of the following lengths:

1999
2000
2001
3999
4000
4001
8001

So. Should I create a JIRA ticket to make AnsiStringType have a public constructor so it can be using in mapping files?? (Sergey / NHibernate team this is to you)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 29, 2007 3:21 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
type="AnsiString" should do what you want.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 29, 2007 11:11 am 
Regular
Regular

Joined: Fri Jan 27, 2006 2:32 pm
Posts: 102
Location: California, USA
sergey wrote:
type="AnsiString" should do what you want.


Yes, that works!

Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.