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