This code
ICriteria crit = service.Session.CreateCriteria(typeof (DatabaseVersion));
crit.Add(Restrictions.Eq("Id.Minor", 4));
IList<DatabaseVersion> list = crit.List<DatabaseVersion>();
causes the following error :NHibernate.QueryException: Type mismatch in NHibernate.Criterion.SimpleExpression: Id.Minor expected type System.Int16, actual type System.Int32
How can i correct this error? I set the type in the mapping file with no luck. I would prefer not having to type cast in code.
Added mapping file as requested.
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Core.NUnit.Domain.DatabaseVersion,Core.NUnit" table="`DatabaseVersion`" lazy="true" >
<composite-id name="Id" class="Core.NUnit.Domain.DatabaseVersionId,Core.NUnit">
<key-property name="Major" column="`Major`" />
<key-property name="Minor" column="`Minor`" type="Int16"/>
<key-property name="Build" column="`Build`" />
<key-property name="Revision" column="`Revision`" />
</composite-id>
<property name="Description" column="`Description`"/>
<property name="DateApplied" column="`DateApplied`"/>
</class>
</hibernate-mapping>