Nhibernate Truncates introduces input procedure parameters with parameter values ​​greater than 4000 characters

How to specify the length of the input parameters of a stored procedure string in Nhibernate mapping files.

this is my displayed content

<sql-query name="Sp_News" resultset-ref="NewsPackResultSet" cacheable="false"> <query-param name="SearchString" type="System.String" /> <query-param name="StartDate" type="System.DateTime" />   exec dbo.Sp_News:SearchString,:StartDate </sql-query> 

When the SearchString parameter is longer than 4000 characters, Nhibernate truncates these parameter values. How can I solve this restriction?

Any help would be appreciated.

+4
source share
1 answer

Found this question, and also found the answer:

 IQuery query = session.GetNamedQuery("Sp_News"); query.SetParameter("SearchString", longString, NHibernateUtil.StringClob); 

NHibernateUtil.StringClob is the key :-)

+6
source

Source: https://habr.com/ru/post/1382058/


All Articles