Since NHibernate does not have enough information to automatically set the parameter length, you must do this manually.
Example:
session.GetNamedQuery("ProcessUploads") .SetParameter("courseId", courseId) .SetParameter("uploadXml", uploadXml, NHibernateUtil.StringClob) .ExecuteUpdate();
In this case, I use StringClob , which translates to NVARCHAR(max) .
source share