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
|