-->
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.  [ 7 posts ] 
Author Message
 Post subject: Oracle problems
PostPosted: Fri May 13, 2005 2:03 pm 
Newbie

Joined: Fri May 13, 2005 2:02 pm
Posts: 8
Thought I'd repost this over here.

I'm testing out nHibernate with oracle 8i databases. In both instances I'm getting

Exception: System.Data.OracleClient.OracleException
Message: ORA-12704: character set mismatch

If I use an expression with createcriteria.

If I just do a list I can retrieve all the rows just fine. Regular ADO using the client libraries works just fine.

In once instance the column is a char(12) and in another it's a varchar2(1).

First database NLS_LANG=american_america.WE8ISO8859P1
Second is american_america.US7ASCII.

Code snip:

IList allCompanys = session.CreateCriteria(typeof(FileType))
.Add(Expression.Eq(field, fldValue))
.List();

Is there some way to set the charset? I do use hibernate without problems with Java.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 13, 2005 2:21 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Is there maybe some connection string parameter will set the charset? Does this happen with HQL queries? I'm not familiar with Oracle, so I can't help much, unfortunately.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 13, 2005 2:54 pm 
Newbie

Joined: Fri May 13, 2005 2:02 pm
Posts: 8
sergey wrote:
Is there maybe some connection string parameter will set the charset? Does this happen with HQL queries? I'm not familiar with Oracle, so I can't help much, unfortunately.


I'll have to check to see if there are any parameter that can be passed. Here is the log file. I tried to format it a little nicer. What I don't understand is that if I use System.Data.OracleClient with a parapared statement it works just fine.

NHibernate.Impl.BatcherImpl [] <> - about to open: 0 open IDbCommands, 0 open DataReaders

NHibernate.Impl.BatcherImpl [] <> - Building an IDbCommand object for the SqlString: SELECT this.file_type as file_type0_, this.created_userid as created_3_0_, this.description as descript2_0_, this.created_dtm as created_4_0_ FROM av49_file_type this WHERE (this.file_type = :this.file_type)

NHibernate.Type.NullableType [] <> - binding 'S' to parameter: 0
2005-05-13 13:49:19,468 [3196] INFO NHibernate.Loader.Loader [] <> - SELECT this.file_type as file_type0_, this.created_userid as created_3_0_, this.description as descript2_0_, this.created_dtm as created_4_0_ FROM av49_file_type this WHERE (this.file_type = :p0)

NHibernate.Impl.BatcherImpl [] <> - Preparing SELECT this.file_type as file_type0_, this.created_userid as created_3_0_, this.description as descript2_0_, this.created_dtm as created_4_0_ FROM av49_file_type this WHERE (this.file_type = :p0)

NHibernate.Connection.DriverConnectionProvider [] <> - Obtaining IDbConnection from Driver

NHibernate.Impl.BatcherImpl [] <> - done closing: 0 open IDbCommands, 0 open DataReaders


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 13, 2005 3:56 pm 
Newbie

Joined: Fri May 13, 2005 2:02 pm
Posts: 8
sergey wrote:
Is there maybe some connection string parameter will set the charset? Does this happen with HQL queries? I'm not familiar with Oracle, so I can't help much, unfortunately.


Here is the problem, but I'm not sure what is causing it.

In this function...

protected virtual IDbDataParameter GenerateParameter( IDbCommand command, string name, Parameter parameter, Dialect.Dialect dialect )


If I comment out this line it works fine.
//dbParam.DbType = parameter.SqlType.DbType;

When the DbType was getting set it was being set to NVarChar2 while the OciType was a VarChar2. Any way to step into that call to see what is happening.

This was the value of DbType.
parameter.SqlType.DbType = String System.Data.DbType


In my class "FileType" this is the field.
[NHibernate.Mapping.Attributes.Id("file_type", typeof(NHibernate.Id.Assigned))]

I'm using attributes. I tried to also set the property value, but everything I tried failed.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 13, 2005 4:06 pm 
Newbie

Joined: Fri May 13, 2005 2:02 pm
Posts: 8
If I set the DbType to AnsiString or nothing it works fine.

op.DbType = System.Data.DbType.AnsiString;

The metaData now says varchar2 like it should.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 15, 2005 11:57 pm 
Contributor
Contributor

Joined: Thu May 12, 2005 12:59 pm
Posts: 20
<property name="..." type="AnsiString" />

if you're using IQuery

q.SetAnsiString( ... )

http://nhibernate.sourceforge.net/nh-do ... basictypes

Mike


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 14, 2006 10:50 am 
Newbie

Joined: Wed Jun 14, 2006 10:31 am
Posts: 6
I have the some problem but using a search criteria...

_________________
www.rbr-online.net


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