-->
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.  [ 4 posts ] 
Author Message
 Post subject: PostgreSQL varchar(0)
PostPosted: Tue Nov 15, 2005 1:13 pm 
Newbie

Joined: Tue Nov 15, 2005 1:01 pm
Posts: 2
When I try to insert a object into the database, then NHibernate does the data binding as expected but the SQL command send to the database has unexpected type settings:

The Log trace from hibernate:

5688 [2112] DEBUG NHibernate.Type.StringType (null) - binding 'mr 1'NHibernateTestClient.exe': Loaded 'c:\projekte\tedradis\entwicklung\trunk\hauptprojekt\src\common\nhibernatetestclient\bin\debug\mono.security.dll', No symbols loaded.
' to parameter: 0
5868 [2112] DEBUG NHibernate.Type.Int32Type (null) - binding '1' to parameter: 1
5868 [2112] DEBUG NHibernate.Type.StringType (null) - binding 'modelrange 1' to parameter: 2
5868 [2112] DEBUG NHibernate.Type.StringType (null) - binding 'fb92f52c579c4369be0f56e1cb00ac45' to parameter: 3
5878 [2112] DEBUG NHibernate.SQL (null) - INSERT INTO modelrange (mr_name, mr_number, mr_comment, guid) VALUES (:p0, :p1, :p2, :p3)
5878 [2112] DEBUG NHibernate.Connection.DriverConnectionProvider (null) - Obtaining IDbConnection from Driver
7580 [2112] DEBUG NHibernate.Impl.BatcherImpl (null) - Closed IDbCommand, open IDbCommands :0
7590 [2112] DEBUG NHibernate.Util.ADOExceptionReporter (null) - could not insert: [DataEntity.ModelRange#fb92f52c579c4369be0f56e1cb00ac45]
Npgsql.NpgsqlException:
length for type varchar must be at least 1
Severity: ERROR
Code: 22023

The Database Log Trace shows:


2005-11-15 17:04:00 STATEMENT: INSERT INTO modelrange (mr_name, mr_number, mr_comment, guid) VALUES ('mr 1'::varchar(0), 1::int4, 'modelrange 1'::varchar(0), '4cb02594b82b438eb138a5acca1e32ea'::varchar(0))


The varchar(0) is incorrect. I have no idea to fix it. I already tried to set the length of the properties in the mapping configuration.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 15, 2005 3:41 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
This looks like some Npgsql quirk, try contacting its author, he's quite responsive fixing bugs.


Top
 Profile  
 
 Post subject: SRC Distribution of Npgsql Driver resolves the problem
PostPosted: Wed Nov 16, 2005 4:25 am 
Newbie

Joined: Tue Nov 15, 2005 1:01 pm
Posts: 2
Thanks for the hint.

I tried the Npgsql Driver (Assembly Version 0.7) from src and it works, but I could not get a clou how nhibernate and npgsql work together to create the prepared statement, because the prepare method of the idbcommand implementation in the npgsql is not called :(


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 16, 2005 7:03 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
This looks like either NHibernate does not set the length of the IDbParameter, or Npgsql has a bug handling the length.


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