These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: NHibernate.QueryException: could not resolve property
PostPosted: Thu Jan 08, 2009 1:42 pm 
Newbie

Joined: Thu Jan 08, 2009 1:30 pm
Posts: 2
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?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 08, 2009 4:26 pm 
Newbie

Joined: Thu Jan 08, 2009 1:30 pm
Posts: 2
Solved it. This post helped:
http://forum.hibernate.org/viewtopic.php?t=974091&highlight=queryexception


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.