Hi,

The following does not work :

ICriteria criteria = SessionManager.GetCurrentSession().CreateCriteria
(typeof(BuzzUserArt));

criteria.SetCacheable(true).CreateAlias("Owner", "owner").Add
(Expression.Like("owner.FullName", suggest,
MatchMode.Anywhere).IgnoreCase());

criteria.SetProjection(
        Projections.Distinct(Projections.ProjectionList()
        .Add(Projections.Alias(Projections.Property("Owner"),
"Owner"))));
        criteria.SetResultTransformer(new
NHibernate.Transform.AliasToBeanResultTransformer(typeof
(BuzzUserArt)));

 return criteria.SetMaxResults(10).List<BuzzUserArt>();

I get the exception :

NHibernate.TransientObjectException : object references an unsaved
transient instance - save the transient instance before flushing:
BuzzArt.BuzzUser

If I remove the Projection, it works just fine. Basically what I'm
trying to do is to get the TOP 10 of all the BuzzUserArt entities
which Owner (of type BuzzUser) has a particular FullName. However I
want distinct records based on the FullName of the Owner property. Not
sure if that's possible ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to