Question

This works

var a = Session.Query<CaptureHistory>()

But this is not working and throw ADOException.

var a = Session.Query<CaptureHistory>().Where(c => c.CaptureName == "");

Exception

"While preparing select capturehis0_.CaptureCode as CaptureC1_2_, capturehis0_.CaptureName as CaptureT4_2_ from CaptureHistory capturehis0_ where capturehis0_.CaptureName=? an error occurred"}

InnerException

"OleDbCommand.Prepare method requires all variable length parameters to have an explicitly set non-zero Size."

Hibernate mapping for field CaptureName

<property name="CaptureType" column="CaptureName" type="String"/>
Était-ce utile?

La solution

First of all, which database are you using and are you really required to use OleDb? If you have MSAccess, get the NHibernate.JetDriver package for example...

If you have to use ole db, maybe try to disable command preparation by setting prepare_sql to false

 <property name="prepare_sql">false</property>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top