Take the 2-minute tour ×

OK, this is going to be kind of a long shot, since it's a big system (which I don't claim to fully understand, yet), and the problem might not be with NHibernate itself, and I'm even having trouble reproducing it, but...

I've got a class with a <dynamic-component> section, and when I run a query on it (through my ASP.NET MVC app), it fails, but only sometimes. (Yeah, the worst kind!)

The exception I'm seeing is:

NHibernate.QueryException: could not resolve property:
Attributes.MyAttributeName of: MyClassName
   at NHibernate.Persister.Entity.AbstractPropertyMapping.GetColumns(String propertyName)
   at NHibernate.Persister.Entity.AbstractPropertyMapping.ToColumns(String alias, String propertyName)
   at NHibernate.Persister.Entity.BasicEntityPropertyMapping.ToColumns(String alias, String propertyName)
   at NHibernate.Persister.Entity.AbstractEntityPersister.ToColumns(String alias, String propertyName)
   at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetColumns(String propertyName, ICriteria subcriteria)
   at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetColumnsUsingProjection(ICriteria subcriteria, String propertyName)
   at NHibernate.Criterion.CriterionUtil.GetColumnNamesUsingPropertyName(ICriteriaQuery criteriaQuery, ICriteria criteria, String propertyName, Object value, ICriterion critertion)
   at NHibernate.Criterion.CriterionUtil.GetColumnNamesForSimpleExpression(String propertyName, IProjection projection, ICriteriaQuery criteriaQuery, ICriteria criteria, IDictionary`2 enabledFilters, ICriterion criterion, Object value)
   at NHibernate.Criterion.SimpleExpression.ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary`2 enabledFilters)
   at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetWhereCondition(IDictionary`2 enabledFilters)
   at NHibernate.Loader.Criteria.CriteriaJoinWalker..ctor(IOuterJoinLoadable persister, CriteriaQueryTranslator translator, ISessionFactoryImplementor factory, CriteriaImpl criteria, String rootEntityName, IDictionary`2 enabledFilters)
   at NHibernate.Loader.Criteria.CriteriaLoader..ctor(IOuterJoinLoadable persister, ISessionFactoryImplementor factory, CriteriaImpl rootCriteria, String rootEntityName, IDictionary`2 enabledFilters)
   at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results)
   at NHibernate.Impl.CriteriaImpl.List(IList results)
   at NHibernate.Impl.CriteriaImpl.UniqueResult[T]()
...my code below here...

Can anybody explain exactly what this QueryException means, i.e., so I can have an idea of what exactly it thinks is going wrong?


share|improve this question
add comment

2 Answers

NHibernate.QueryException: could not resolve property: Attributes.MyAttributeName of: MyClassName

I think, "MyAttributeName" property does not map with the field.

Can you provide more info ?

share|improve this answer
Well, there is no "field" -- it's in the dynamic-component hashtable. But yeah, it looks like it's losing the mapping somewhere... –  Ken Dec 16 '09 at 0:34
add comment

It turns out my problem was just outside of NHibernate, and this was just the most direct symptom of the actual problem.

(I'd describe the real problem, but the details wouldn't really be that interesting or helpful to other people. Except to say that: caches are pretty useful, everybody, except when you make a mistake and they don't return the thing they should!)

I tried to close this question, but I just get the "A problem occurred during closing/reopening" popup, so just pretend it got closed.

share|improve this answer
add comment

Your Answer


