consider this query

var query =
                session.CreateQuery(
                    @"select e.StudyHistories as StudyHistories
>From Enrollment e where e.User.UserName =:user and e.Name = :name")
                    .SetParameter("user", "Hoang")
                    .SetParameter("name", "TestEnrollment");

            var result = query.List<StudyHistory>();

<--- this work fine so we know that the mapping and other stuff works.

yet if I do this

var result =
query.SetResultTransformer(Transformers.AliasToBean<TwoCollection>()).UniqueResult<TwoCollection>();

Where two collection is
        public class TwoCollection
        {
            public IList<StudyHistory> StudyHistories { get; set; }
            public IList<StudyVerificationHistory>
StudyVerificationHistories { get; set; }
        }

I am getting this exception
System.ArgumentException: Object of type 'Test.Core.DomainModel.StudyHistory'

cannot be converted to type
'System.Collections.Generic.IList`1[Test.Core.DomainModel.StudyHistory]'.

In short when I am doing a select projection with Hql via the transformer,
somehow I am getting back a single object rather than a list
but Enrollment => StudyHistories is a one to many relationship

clearly the first query return multiple rows.

Did I overlook anything or is this a bug?

I am also seeing 15 rows returned back via NHProf so I should get back a
collections...

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to