I encountered this a long time ago.  Give this blog post a try.

http://thebasilet.blogspot.com/2009/07/nhibernate-oracle-clobs.html


-Carlos

 

Practice makes perfect, but if no one is perfect, why practice?




> Date: Tue, 7 Dec 2010 07:40:43 -0800
> Subject: [nhusers] NHibernate 2.1.2 GA + Oracle + clob/nclob = ORA-01461
> From: [email protected]
> To: [email protected]
> 
> When I try save more than 2000 chars into clob/nclob
> ORA-01461: can bind a LONG value only for insert into a LONG column
> error is occured.
> 
> using (ITransaction transaction = session.BeginTransaction())
> {
>       TestTableTypes
>               TestTableTypes;
> 
>       string
>               //tmpString = new string('я', 0x0ffff);
>               //tmpString = new string('я', 2000);
>               //tmpString = new string('я', 2001);
> 
>       #if !TEST_CLOB_BY_OBJECT
>               TestTableTypes = new TestTableTypes();
>               TestTableTypes.Id = 1;
>               TestTableTypes.FClob = tmpString;
>               TestTableTypes.FNClob = tmpString;
>               session.SaveOrUpdate(TestTableTypes);
>       #else
>               query = session.CreateQuery("FROM TestTableTypes WHERE Id = 1");
>               TestTableTypes = query.List<TestTableTypes>()[0];
>               TestTableTypes.FClob = tmpString;
>               TestTableTypes.FNClob = tmpString;
>       #endif
> 
>       transaction.Commit();
> }
> 
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-
> import="true">
>   <class name="AnyTestOracleCastle.TestTableTypes,
> AnyTestOracleCastle" lazy="true">
>     <id name="Id">
>       <generator class="native" />
>     </id>
>     <property name="FVarchar2" />
>     <property name="FNVarchar2" />
>     <property name="FClob" />
>     <property name="FNClob" column="FNClob" type="StringClob" not-
> null="false" />
>   </class>
> </hibernate-mapping>
> 
> But tmpString = new string('я', 0x0ffff) is saved without error.
> 
> P.S.
> http://www.google.com/#&q=ora-01461+can+bind+a+long+value+only+for+insert+into+a+long+column+clob
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/nhusers?hl=en.
> 
                                          

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to