From: NHibernate J. <mik...@us...> - 2007-03-20 10:48:29
|
[ http://jira.nhibernate.org/browse/NH-942?page=comments#action_15316 ] Sergey Koshcheyev commented on NH-942: -------------------------------------- See NH-877 for more information. > Ignored class arbitrary sql where condition > -------------------------------------------- > > Key: NH-942 > URL: http://jira.nhibernate.org/browse/NH-942 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.2.0.CR1 > Reporter: Dariusz Uzar > > NHibernate ignores arbitrary sql where condition on the class mapping level while fetching collection of child objects. > Example: > <class name="Child" table="Children" where="type = 'C'"> > <id name="Id"> > <column name="Id" sql-type="char(32)" not-null="true"/> > <generator class="uuid.hex" /> > </id> > <property name="Name" column="Name" length="16" not-null="true"/> > <property name="Type" /> > <many-to-one name="Parent" class="Parent" column="parentId" /> > </class> > <class name="Parent" table="Parents" > > <id name="Id"> > <column name="Id" sql-type="char(32)" not-null="true"/> > <generator class="uuid.hex" /> > </id> > <property name="Name" column="Name" length="16" not-null="true"/> > <set name="Children" inverse="true" cascade="all" lazy="true"> > <key column="parentId" /> > <one-to-many class="Child" /> > </set> > </class> > While accessing parent.Children NHibernate generates SQL: > SELECT children0_.parentId as parentId__1_, children0_.Id as Id1_, children0_.Id as Id1_0_, children0_.Name as Name1_0_, children0_.Type as Type1_0_, children0_.parentId as parentId1_0_ > FROM Children children0_ > WHERE children0_.parentId=@p0 > there is no children0_.type = 'C' condition. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |