-->
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: Error when using Projections.GroupProperty
PostPosted: Tue Jun 26, 2007 10:22 am 
Newbie

Joined: Fri Feb 02, 2007 8:12 pm
Posts: 3
Location: St. Louis, Missouri, USA
I have a ContractElement domain object, with a property that relates to a corresponding Team domain object. When I execute the following code:

Code:
DetachedCriteria crit = DetachedCriteria.For<ContractElement>();
crit.SetProjection(Projections.GroupProperty("Team"));
...
crit.GetExecutableCriteria(session).List<ContractElement>();


I get the exception:

Code:
System.ArgumentException: The value "Domain.Team" is not of type "Domain.ContractElement" and cannot be used in this generic collection.
Parameter name: value
at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType)
at System.Collections.Generic.List`1.VerifyValueType(Object value)
at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item)
at NHibernate.Util.ArrayHelper.AddAll(IList to, IList from)
at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria, IList results)

NHibernate.ADOException: Unable to perform find
at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria, IList results)
at NHibernate.Impl.SessionImpl.Find[T](CriteriaImpl criteria)
at NHibernate.Impl.CriteriaImpl.List[T]()


All I want is to group my results so I'll only have one element per team. Is there something I'm missing here that's making this not work?

TIA,
Doug


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.