-->
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: Keeping NHibernate from Reusing Parameter Objects
PostPosted: Tue Oct 31, 2006 3:01 pm 
Beginner
Beginner

Joined: Thu Dec 01, 2005 1:09 pm
Posts: 33
Hi,

I have written an IUserType to support CLOB column on Gupta SQLBase databases.

It works perfectly as long as I don't try to store two objects of the same class that uses that type within one session.
The problem is that the parameter objects that are passed to NullSafeSet are reused and that the Gupta ADO.NET driver modifies the parameter after assigning a string to it:

At first the underlying DBType is String (which is correct). The driver then successfully assigns the passed value (which is a System.String).
However, if the value is longer than 254 characters, the DBType will be changed to Binary for some internal reason. No problem so far.
But: If this parameter object is reused, the setter will see that the DBType is Binary and try to cast the value to byte[], which (of course) fails with an InvalidCastException.

I think the cleanest solution would be to make NHibernate create new parameter objects instead of reusing the ones that were used in a previous statement.

Is that possible? Otherwise I'd have to write a dirty workaround to undo the "damage" caused by the Gupta driver...

NHibernate version:

1.0.2

Mapping documents:

Code:
<property name="LongData" column="DATA_LONG" type="MyClobType"></property>


Name and version of the database you are using:

SQLBase 9.0

Cheers,
Marvin


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.