From: NHibernate J. <mik...@us...> - 2007-03-14 15:39:47
|
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.GA, 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 |
From: NHibernate J. <mik...@us...> - 2007-03-20 09:39:31
|
[ http://jira.nhibernate.org/browse/NH-942?page=all ] Sergey Koshcheyev updated NH-942: --------------------------------- Version: (was: 1.2.0.GA) > 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 |
From: NHibernate J. <mik...@us...> - 2007-03-20 09:42:28
|
[ http://jira.nhibernate.org/browse/NH-942?page=all ] Sergey Koshcheyev closed NH-942: -------------------------------- Resolution: Not an Issue Specify where="..." for the collection. > 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 |
From: NHibernate J. <mik...@us...> - 2007-03-20 10:42:31
|
[ http://jira.nhibernate.org/browse/NH-942?page=comments#action_15315 ] Dariusz Uzar commented on NH-942: --------------------------------- I've also found this solution, but I think it's only getting around of the problem. NHibernate v 1.0.2 handles such where condition correctly. In my opinion this is an erorr. It leads to the situation where in the parent's collection may appear objects that are not instances of the child class (becouse of the where condition). IMHO where condition on the collection level should be used only to filter child elements. > 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 |
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 |