-->
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: Could not resolve property Id
PostPosted: Tue Nov 21, 2006 5:56 am 
Beginner
Beginner

Joined: Tue May 17, 2005 2:48 pm
Posts: 47
Hibernate version:

Version of NHibernate.dll: NHibernate 1.0.2.0

Mapping documents:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="App.Core.Domain.Customer, App.Core" table="Customer">
<id name="ID" column="CustomerID">
<generator class="identity" />
</id>
<property name="FirstName" column="FirstName" />
<property name="LastName" column="LastName" />
</class>
</hibernate-mapping>

Full stack trace of any exception that occurs:

[QueryException: could not resolve property:Id of :App.Core.Domain.Customer]
NHibernate.Persister.AbstractPropertyMapping.ToType(String propertyName) +152
NHibernate.Expression.AbstractCriterion.GetType(ISessionFactoryImplementor factory, Type persistentClass, String property, IDictionary aliasClasses) +181
NHibernate.Expression.InExpression.ToSqlString(ISessionFactoryImplementor factory, Type persistentClass, String alias, IDictionary aliasClasses) +163
NHibernate.Expression.NotExpression.ToSqlString(ISessionFactoryImplementor factory, Type persistentClass, String alias, IDictionary aliasClasses) +145
NHibernate.Loader.CriteriaLoader..ctor(IOuterJoinLoadable persister, ISessionFactoryImplementor factory, CriteriaImpl criteria) +468
NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria) +322
NHibernate.Impl.CriteriaImpl.List() +33
App.Data.GenericNHibernateDao`1.GetByCriteria(ICriterion[] criterion) in C:\PROJECTS\ASP.NET\App\Src\Data\App.Data\GenericNHibernateDao.cs:63
AddCustomer.Page_Load(Object sender, EventArgs e) in c:\PROJECTS\ASP.NET\App\Src\App\Customer\AddCustomer.aspx.cs:37
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +31
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +68
System.Web.UI.Control.OnLoad(EventArgs e) +88
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3037

Name and version of the database you are using:

SQL Server 2005




Hi,

I have a Customer object which is derived from DomainObject. DomainObject has a property Id.
I want to get a list of customers which id's are different than a given set of customer id's. I use the following code for this.

CustomerDao.GetByCriteria(new ICriterion[] { Expression.Not(Expression.In("Id", excludedCustomers)) });

This code returns the following error:
could not resolve property:Id of :App.Core.Domain.Customer

Can't I use criteria for properties which reside in baseclasses? Like I said, the property id does not reside in the Customer object, but in the DomainObject object. When I try to use a property which does reside in the Customer object (FirstName, LastName), all goes well.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 21, 2006 10:06 am 
Regular
Regular

Joined: Mon Jul 18, 2005 4:10 am
Posts: 92
Location: Poland
not 100% sure but aren't property names case-sensitive?

you have ID in the mapping and Id in the Criteria

_________________
michal


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.