I have a table called NotificationUpload with the following structure:
NotificationUploadID int (PK)
NotificationID int (FK)
FilePath nvarchar(100)
FileName nvarchar(100)
FileType nvarchar(100)
This is the corr hbm and class:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="SS2BR.Persistence.SS2BR" namespace="SS2BR.Persistence.SS2BR">
<class name="NotificationUpload" table="NotificationUpload">
<id name="NotificationUploadID" column="NotificationUploadID" access="field.camelcase-underscore">
<generator class="native"/>
</id>
<many-to-one name="Notification" column="NotificationID" class="SS2BR.Persistence.SS2BR.Notification" access="field.camelcase-underscore"/>
<property name="FilePath" column="FilePath" type="string" access="field.camelcase-underscore"/>
<property name="FileName" column="FileName" type="string" access="field.camelcase-underscore"/>
<property name="FileType" column="FileType" type="string" access="field.camelcase-underscore"/>
</class>
</hibernate-mapping>
public partial class NotificationUpload
{
#region Fields
private int _notificationUploadID;
private Notification _notification;
private string _filePath;
private string _fileName;
private string _fileType;
#endregion
#region Constructors
public NotificationUpload()
{
}
public NotificationUpload(
int p_notificationUploadID,
Notification p_notification,
string p_filePath,
string p_fileName,
string p_fileType)
{
_notificationUploadID = p_notificationUploadID;
_notification = p_notification;
_filePath = p_filePath;
_fileName = p_fileName;
_fileType = p_fileType;
}
#endregion
#region Properties
public virtual int NotificationUploadID
{
get { return _notificationUploadID; }
}
public virtual Notification Notification
{
get { return _notification; }
set { _notification = value; }
}
public virtual string FilePath
{
get { return _filePath; }
set {_filePath = value;}
}
public virtual string FileName
{
get { return _fileName; }
set {_fileName = value;}
}
public virtual string FileType
{
get { return _fileType; }
set {_fileType = value;}
}
}
#endregion
} // NotificationUpload
In another business object I have the following method:
public static NotificationUpload getNotificationUpload(int notificationID)
{
ISession ss2brDB = null;
ICriteria criteria = null;
SS2BR.Persistence.SS2BR.NotificationUpload nu = null;
try
{
using (ss2brDB = SS2BR.Persistence.SessionManager.Instance.GetSessionFrom("SS2BR_affiliate"))
{
criteria = ss2brDB.CreateCriteria(typeof(NotificationUpload));
criteria.Add(Expression.Eq("NotificationUpload.NotificationID", notificationID));
nu = (NotificationUpload)criteria.UniqueResult();
}
}
catch (Exception exc)
{
Logger.Error(exc.Message, exc);
}
return nu;
}
The line (NotificationUpload)criteria.UniqueResult(); throws an exception which says :
could not resolve property: NotificationUpload of: SS2BR.Persistence.SS2BR.NotificationUpload
Any ideas?
|