-->
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.  [ 1 post ] 
Author Message
 Post subject: "property does not map to a single column" Except
PostPosted: Thu Dec 11, 2008 6:15 am 
Newbie

Joined: Wed Nov 21, 2007 1:27 pm
Posts: 4
NHibernate version: 2.0.1.4000 / SQLServer 2005

Hi everyone, I got a "property does not map to a single column" exception if I try to do a projection on a many-to-one property with two columns.

Here is my mapping:

<class name="ObjectKernel" table="ObjectsTable">
<id name="Id" column="IdObject">
<generator class="native" />
</id>
<many-to-one name="Domain" class="DomainKernel" column="IdDomain" />
<many-to-one name="Url" class="UrlKernel">
<column name="IdUrl" />
<column name="IdDomain" />
</many-to-one>
<property ............>
<property ............>
<property ............>
</class>

<class name="UrlKernel" table="UrlTable" >
<composite-id>
<key-property name="IdDomain" column="IdDomain" />
<key-property name="Id" column="IdUrl" />
</composite-id>
<property name="Url" column="Url" />
</class>

<class name="DomainKernel" table="DomainTable">
<id name="Id" column="IdDomain">
<generator class="native" />
</id>
<property name="Domain" column="Domain" />
</class>

My problem :

When I use criteria API on ObjectKernel with projections group by on "Url", I got a "NHibernate.QueryException : property does not map to a single column: Url"

--QueryException
\NHibernate\Loader\Criteria\CriteriaQueryTranslator.cs(485,0): à NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetColumn(ICriteria criteria, String propertyName)
\NHibernate\Criterion\PropertyProjection.cs(51,0): à NHibernate.Criterion.PropertyProjection.ToSqlString(ICriteria criteria, Int32 loc, ICriteriaQuery criteriaQuery, IDictionary`2 enabledFilters)
\NHibernate\Criterion\AliasedProjection.cs(24,0): à NHibernate.Criterion.AliasedProjection.ToSqlString(ICriteria criteria, Int32 position, ICriteriaQuery criteriaQuery, IDictionary`2 enabledFilters)
\NHibernate\Criterion\ProjectionList.cs(56,0): à NHibernate.Criterion.ProjectionList.ToSqlString(ICriteria criteria, Int32 loc, ICriteriaQuery criteriaQuery, IDictionary`2 enabledFilters)
\NHibernate\Loader\Criteria\CriteriaQueryTranslator.cs(399,0): à NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetSelect(IDictionary`2 enabledFilters)
\NHibernate\Loader\Criteria\CriteriaJoinWalker.cs(42,0): à NHibernate.Loader.Criteria.CriteriaJoinWalker..ctor(IOuterJoinLoadable persister, CriteriaQueryTranslator translator, ISessionFactoryImplementor factory, CriteriaImpl criteria, String rootEntityName, IDictionary`2 enabledFilters)
\NHibernate\Loader\Criteria\CriteriaLoader.cs(47,0): à NHibernate.Loader.Criteria.CriteriaLoader..ctor(IOuterJoinLoadable persister, ISessionFactoryImplementor factory, CriteriaImpl rootCriteria, String rootEntityName, IDictionary`2 enabledFilters)
\NHibernate\Impl\SessionImpl.cs(1568,0): à NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results)
\NHibernate\Impl\CriteriaImpl.cs(455,0): à NHibernate.Impl.CriteriaImpl.List(IList results)
\NHibernate\Impl\CriteriaImpl.cs(446,0): à NHibernate.Impl.CriteriaImpl.List()

Thanks for help.

Iban


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

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.