I have the same problem... There is a way to do that with Stateless Session? I'am using NHibernate 3.1. Thanks.
2010/11/27 SAMI AKKUS <[email protected]> > I have found the problem. I used Stateless session. After changing it to > session, it works > > > 2010/11/27 zamix <[email protected]> > >> This is my entity base class. I couldnt find the problem. Please help >> me >> >> public class EntityBase >> { >> public virtual Guid ID { get; set; } >> public virtual bool State { get; set; } >> public virtual DateTime CreateDate { get; set; } >> >> public override bool Equals(object entity) >> { >> if (entity == null || !(entity is EntityBase)) >> { >> return false; >> } >> return (this == (EntityBase)entity); >> } >> >> >> public static bool operator ==(EntityBase base1, EntityBase >> base2) >> { >> if ((object)base1 == null && (object)base2 == null) >> { >> return true; >> } >> >> if ((object)base1 == null || (object)base2 == null) >> { >> return false; >> } >> >> if (base1.ID != base2.ID) >> { >> return false; >> } >> >> return true; >> } >> >> public static bool operator !=(EntityBase base1, EntityBase >> base2) >> { >> return (!(base1 == base2)); >> } >> >> public override int GetHashCode() >> { >> return this.ID.GetHashCode(); >> } >> } >> >> On 27 Kasım, 17:28, Fabio Maulo <[email protected]> wrote: >> > The implementation of the equality comparer ? >> > >> > >> > >> > >> > >> > On Sat, Nov 27, 2010 at 11:29 AM, SAMI AKKUS <[email protected]> >> wrote: >> > > I have a mapping file as below. What my problem is NHibernate do not >> return >> > > distinct result after querying like following: >> > >> > > _session.CreateQuery("select a from RoleApplication a left join fetch >> > > a.ChildRoleApplications") >> > > .SetResultTransformer(new >> > > DistinctRootEntityResultTransformer()) >> > > .List<RoleApplication>() >> > >> > > What may be the problem? >> > >> > > <many-to-one name="Role" column="RoleID"/> >> > > <many-to-one name="Parent" column="ParentID"/> >> > > <many-to-one name="RedirectedRoleApplication" >> > > column="RedirectedRoleApplicationID" /> >> > > <set name="ChildRoleApplications" inverse="true" >> > > cascade="all-delete-orphan" lazy="true"> >> > > <key column="ParentID" /> >> > > <one-to-many class="RoleApplication" /> >> > > </set> >> > > <set name="Frames" inverse="true" >> cascade="all-delete-orphan"> >> > > <key column="RoleApplicationID" /> >> > > <one-to-many class="Frame" /> >> > > </set>... >> > >> > > Thanks in advance. >> > >> > > -- >> > > 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]< >> nhusers%[email protected]> >> > > . >> > > For more options, visit this group at >> > >http://groups.google.com/group/nhusers?hl=en. >> > >> > -- >> > Fabio Maulo- Alıntıyı gizle - >> > >> > - Alıntıyı göster - >> >> -- >> 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. >> >> > -- > 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. > -- Nicolás Matías Marzoni -- 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.
