Hi.
I'm using ExcludeZeroes() method from ICriteria and it's not working.
The mapping:
Code:
...
<id name="Id" column="id" type="Int32">
<generator class="assigned"/>
</id>
...
<property column="passwordformat" type="Int32" name="PasswordFormat" not-null="true" />
...
The code used to generate the QBE:
Code:
public static IList ListByExample(object example)
{
ISession session = null;
try
{
session = NHibernateHelper.OpenSession();
ICriteria criteria = session.CreateCriteria(example.GetType());
Example sample = Example.Create(example);
sample.ExcludeZeroes();
sample.ExcludeNulls();
criteria.Add(sample);
return criteria.List();
}
finally
{
NHibernateHelper.CloseSession(session);
}
}
The SQL generated:
Code:
SELECT ... FROM nhuser this WHERE (this.passwordformat = 0 and ...)
The Int32 field is set = 0 on the constructor of the object. Using ExcludeZeroes() it still in the sql :(
Does ExcludeZeroes() not work? Should I use Nullable Types?
Thanks