Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
CreateCriteria.List<T> is not returning anything, I mean it returns an empty list. Should it not return Invoices. "T" passed in is of type Invoice as it has been mapped.
Need help with this, as I am just starting to learn NHibernate.
Hibernate version: 1.2.1
Mapping documents:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping
xmlns="urn:nhibernate-mapping-2.2"
schema=""
default-cascade="none"
auto-import="true"
assembly="Intelliun.Core" namespace="Intelliun.Core.Entities.billing"
>
<class name="Invoice"
table="INVOICE"
lazy="true"
>
<id name = "RecordId"
type = "Guid"
column="VEOID"
unsaved-value="0"
access="property"
>
<generator class="guid.comb"></generator>
</id>
<property name = "number"
column = "NUMBER"
type = "String"
access="field.camelcase-underscore"
/>
<property name = "date"
column = "DATE"
access="field.camelcase-underscore"
/>
<property name = "unpaidBalance"
column = "UNPAID_BALANCE"
access="field.camelcase-underscore"
/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
public ISession NHSession
{
get
{
if (_nhSession == null)
{
_nhSession = NHibernateHelper.GetCurrentSession();
}
return _nhSession;
}
set
{
_nhSession = value;
}
}
public EntityBag<T> FindAll<T>() where T : EntityBase
{
try
{
return new EntityBag<T>(NHSession.CreateCriteria(typeof(T)).List<T>());
}
catch (HibernateException ex)
{
throw new InfrastrucureException(ex);
}
}
Full stack trace of any exception that occurs: No Exception
Name and version of the database you are using: MS SQL Express 2005