[nhibernate-issues] [JIRA] Created: (NH-766) Avoid joins on
<composite-key><key-many-to-one> queries
From: NHibernate J. <mik...@us...> - 2006-10-23 13:43:36
|
Avoid joins on <composite-key><key-many-to-one> queries ------------------------------------------------------- Key: NH-766 URL: http://jira.nhibernate.org/browse/NH-766 Project: NHibernate Type: Improvement Components: Core Versions: 1.0.2 Reporter: Kirk Wylie Priority: Trivial This is being promoted from something I posted on the NHibernate forums. Using NHibernate 1.0.2.0 against Oracle 9. I'm working with an existing schema which isn't using surrogate keys, and I have a composite key of the form: <class name="CalculatedRating" ...> <composite-id> <key-property name="EffectiveDate" column="EFFECTIVE_DATE"/> <key-many-to-one name="FdeOrganization" column="ORGANIZATION_ID" .../> </composite-id> ... </class> Using this query: from CalculatedRating cr inner join fetch cr.FdeOrganization fdeOrg left join fetch fdeOrg.Attributes as attribute inner join fetch attribute.AttributeType where cr.EffectiveDate = (select max(cr2.EffectiveDate) from CalculatedRating cr2 where cr2.EffectiveDate >= :EffectiveDate) order by cr.FdeOrganization.OrgId NHibernate is quite correctly generating the SQL necessary to completely manifest the CalculatedRating element in a single query. However, after executing that query, it then still proceeds to do the N+1 select on FdeOrganization. As in this application I'm actually using quite a few cases where I'm successfully using the inner join fetch technique against FdeOrganization, I can only assume that this is a problem related to key-many-to-one rather than many-to-one. After further investigation, I can establish that Hibernate 3.1.3 exposes the exact same functionality. I'm filing this first against NHibernate since that's where I first discovered it, however, since it affects Hibernate as well it might be better filed against that, and I can do so if needed. -- 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...> - 2006-10-23 13:52:33
|
[ http://jira.nhibernate.org/browse/NH-766?page=comments#action_14151 ] Sergey Koshcheyev commented on NH-766: -------------------------------------- Can you supply a small simple NUnit test case? > Avoid joins on <composite-key><key-many-to-one> queries > ------------------------------------------------------- > > Key: NH-766 > URL: http://jira.nhibernate.org/browse/NH-766 > Project: NHibernate > Type: Improvement > Components: Core > Versions: 1.0.2 > Reporter: Kirk Wylie > Priority: Trivial > > This is being promoted from something I posted on the NHibernate forums. > Using NHibernate 1.0.2.0 against Oracle 9. > I'm working with an existing schema which isn't using surrogate keys, and I have a composite key of the form: > <class name="CalculatedRating" ...> > <composite-id> > <key-property name="EffectiveDate" column="EFFECTIVE_DATE"/> > <key-many-to-one name="FdeOrganization" column="ORGANIZATION_ID" .../> > </composite-id> > ... > </class> > Using this query: > from CalculatedRating cr > inner join fetch cr.FdeOrganization fdeOrg > left join fetch fdeOrg.Attributes as attribute > inner join fetch attribute.AttributeType > where cr.EffectiveDate = > (select max(cr2.EffectiveDate) > from CalculatedRating cr2 > where cr2.EffectiveDate >= :EffectiveDate) > order by cr.FdeOrganization.OrgId > NHibernate is quite correctly generating the SQL necessary to completely manifest the CalculatedRating element in a single query. However, after executing that query, it then still proceeds to do the N+1 select on FdeOrganization. > As in this application I'm actually using quite a few cases where I'm successfully using the inner join fetch technique against FdeOrganization, I can only assume that this is a problem related to key-many-to-one rather than many-to-one. > After further investigation, I can establish that Hibernate 3.1.3 exposes the exact same functionality. I'm filing this first against NHibernate since that's where I first discovered it, however, since it affects Hibernate as well it might be better filed against that, and I can do so if needed. -- 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...> - 2006-10-23 13:54:35
|
[ http://jira.nhibernate.org/browse/NH-766?page=comments#action_14152 ] Kirk Wylie commented on NH-766: ------------------------------- I can try to, but extracting one given a relatively proprietary schema (that I had to extract things out of above) might take some time. Given that it affects Hibernate as well, and I'm going to that effort, do you recommend doing that in Hibernate (JUnit) or NHibernate (NUnit)? > Avoid joins on <composite-key><key-many-to-one> queries > ------------------------------------------------------- > > Key: NH-766 > URL: http://jira.nhibernate.org/browse/NH-766 > Project: NHibernate > Type: Improvement > Components: Core > Versions: 1.0.2 > Reporter: Kirk Wylie > Priority: Trivial > > This is being promoted from something I posted on the NHibernate forums. > Using NHibernate 1.0.2.0 against Oracle 9. > I'm working with an existing schema which isn't using surrogate keys, and I have a composite key of the form: > <class name="CalculatedRating" ...> > <composite-id> > <key-property name="EffectiveDate" column="EFFECTIVE_DATE"/> > <key-many-to-one name="FdeOrganization" column="ORGANIZATION_ID" .../> > </composite-id> > ... > </class> > Using this query: > from CalculatedRating cr > inner join fetch cr.FdeOrganization fdeOrg > left join fetch fdeOrg.Attributes as attribute > inner join fetch attribute.AttributeType > where cr.EffectiveDate = > (select max(cr2.EffectiveDate) > from CalculatedRating cr2 > where cr2.EffectiveDate >= :EffectiveDate) > order by cr.FdeOrganization.OrgId > NHibernate is quite correctly generating the SQL necessary to completely manifest the CalculatedRating element in a single query. However, after executing that query, it then still proceeds to do the N+1 select on FdeOrganization. > As in this application I'm actually using quite a few cases where I'm successfully using the inner join fetch technique against FdeOrganization, I can only assume that this is a problem related to key-many-to-one rather than many-to-one. > After further investigation, I can establish that Hibernate 3.1.3 exposes the exact same functionality. I'm filing this first against NHibernate since that's where I first discovered it, however, since it affects Hibernate as well it might be better filed against that, and I can do so if needed. -- 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...> - 2006-10-23 13:56:36
|
[ http://jira.nhibernate.org/browse/NH-766?page=comments#action_14153 ] Sergey Koshcheyev commented on NH-766: -------------------------------------- Hibernate is probably better, once/if it will be fixed in Hibernate I can then port the fix. > Avoid joins on <composite-key><key-many-to-one> queries > ------------------------------------------------------- > > Key: NH-766 > URL: http://jira.nhibernate.org/browse/NH-766 > Project: NHibernate > Type: Improvement > Components: Core > Versions: 1.0.2 > Reporter: Kirk Wylie > Priority: Trivial > > This is being promoted from something I posted on the NHibernate forums. > Using NHibernate 1.0.2.0 against Oracle 9. > I'm working with an existing schema which isn't using surrogate keys, and I have a composite key of the form: > <class name="CalculatedRating" ...> > <composite-id> > <key-property name="EffectiveDate" column="EFFECTIVE_DATE"/> > <key-many-to-one name="FdeOrganization" column="ORGANIZATION_ID" .../> > </composite-id> > ... > </class> > Using this query: > from CalculatedRating cr > inner join fetch cr.FdeOrganization fdeOrg > left join fetch fdeOrg.Attributes as attribute > inner join fetch attribute.AttributeType > where cr.EffectiveDate = > (select max(cr2.EffectiveDate) > from CalculatedRating cr2 > where cr2.EffectiveDate >= :EffectiveDate) > order by cr.FdeOrganization.OrgId > NHibernate is quite correctly generating the SQL necessary to completely manifest the CalculatedRating element in a single query. However, after executing that query, it then still proceeds to do the N+1 select on FdeOrganization. > As in this application I'm actually using quite a few cases where I'm successfully using the inner join fetch technique against FdeOrganization, I can only assume that this is a problem related to key-many-to-one rather than many-to-one. > After further investigation, I can establish that Hibernate 3.1.3 exposes the exact same functionality. I'm filing this first against NHibernate since that's where I first discovered it, however, since it affects Hibernate as well it might be better filed against that, and I can do so if needed. -- 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...> - 2006-10-23 14:09:32
|
[ http://jira.nhibernate.org/browse/NH-766?page=comments#action_14155 ] Kirk Wylie commented on NH-766: ------------------------------- Created Hibernate request http://opensource.atlassian.com/projects/hibernate/browse/HHH-2170 to track. > Avoid joins on <composite-key><key-many-to-one> queries > ------------------------------------------------------- > > Key: NH-766 > URL: http://jira.nhibernate.org/browse/NH-766 > Project: NHibernate > Type: Improvement > Components: Core > Versions: 1.0.2 > Reporter: Kirk Wylie > Priority: Trivial > > This is being promoted from something I posted on the NHibernate forums. > Using NHibernate 1.0.2.0 against Oracle 9. > I'm working with an existing schema which isn't using surrogate keys, and I have a composite key of the form: > <class name="CalculatedRating" ...> > <composite-id> > <key-property name="EffectiveDate" column="EFFECTIVE_DATE"/> > <key-many-to-one name="FdeOrganization" column="ORGANIZATION_ID" .../> > </composite-id> > ... > </class> > Using this query: > from CalculatedRating cr > inner join fetch cr.FdeOrganization fdeOrg > left join fetch fdeOrg.Attributes as attribute > inner join fetch attribute.AttributeType > where cr.EffectiveDate = > (select max(cr2.EffectiveDate) > from CalculatedRating cr2 > where cr2.EffectiveDate >= :EffectiveDate) > order by cr.FdeOrganization.OrgId > NHibernate is quite correctly generating the SQL necessary to completely manifest the CalculatedRating element in a single query. However, after executing that query, it then still proceeds to do the N+1 select on FdeOrganization. > As in this application I'm actually using quite a few cases where I'm successfully using the inner join fetch technique against FdeOrganization, I can only assume that this is a problem related to key-many-to-one rather than many-to-one. > After further investigation, I can establish that Hibernate 3.1.3 exposes the exact same functionality. I'm filing this first against NHibernate since that's where I first discovered it, however, since it affects Hibernate as well it might be better filed against that, and I can do so if needed. -- 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 |
[nhibernate-issues] [JIRA] Updated: (NH-766) Avoid joins on
<composite-key><key-many-to-one> queries
From: NHibernate J. <mik...@us...> - 2006-11-13 18:03:38
|
[ http://jira.nhibernate.org/browse/NH-766?page=all ] Sergey Koshcheyev updated NH-766: --------------------------------- Fix Version: LATER > Avoid joins on <composite-key><key-many-to-one> queries > ------------------------------------------------------- > > Key: NH-766 > URL: http://jira.nhibernate.org/browse/NH-766 > Project: NHibernate > Type: Improvement > Components: Core > Versions: 1.0.2 > Reporter: Kirk Wylie > Priority: Trivial > Fix For: LATER > > This is being promoted from something I posted on the NHibernate forums. > Using NHibernate 1.0.2.0 against Oracle 9. > I'm working with an existing schema which isn't using surrogate keys, and I have a composite key of the form: > <class name="CalculatedRating" ...> > <composite-id> > <key-property name="EffectiveDate" column="EFFECTIVE_DATE"/> > <key-many-to-one name="FdeOrganization" column="ORGANIZATION_ID" .../> > </composite-id> > ... > </class> > Using this query: > from CalculatedRating cr > inner join fetch cr.FdeOrganization fdeOrg > left join fetch fdeOrg.Attributes as attribute > inner join fetch attribute.AttributeType > where cr.EffectiveDate = > (select max(cr2.EffectiveDate) > from CalculatedRating cr2 > where cr2.EffectiveDate >= :EffectiveDate) > order by cr.FdeOrganization.OrgId > NHibernate is quite correctly generating the SQL necessary to completely manifest the CalculatedRating element in a single query. However, after executing that query, it then still proceeds to do the N+1 select on FdeOrganization. > As in this application I'm actually using quite a few cases where I'm successfully using the inner join fetch technique against FdeOrganization, I can only assume that this is a problem related to key-many-to-one rather than many-to-one. > After further investigation, I can establish that Hibernate 3.1.3 exposes the exact same functionality. I'm filing this first against NHibernate since that's where I first discovered it, however, since it affects Hibernate as well it might be better filed against that, and I can do so if needed. -- 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 |
[nhibernate-issues] [JIRA] Updated: (NH-766) Avoid joins on
<composite-key><key-many-to-one> queries
From: NHibernate J. <mik...@us...> - 2006-11-13 18:43:48
|
[ http://jira.nhibernate.org/browse/NH-766?page=all ] Sergey Koshcheyev updated NH-766: --------------------------------- Comment: was deleted > Avoid joins on <composite-key><key-many-to-one> queries > ------------------------------------------------------- > > Key: NH-766 > URL: http://jira.nhibernate.org/browse/NH-766 > Project: NHibernate > Type: Improvement > Components: Core > Versions: 1.0.2 > Reporter: Kirk Wylie > Priority: Trivial > Fix For: LATER > > This is being promoted from something I posted on the NHibernate forums. > Using NHibernate 1.0.2.0 against Oracle 9. > I'm working with an existing schema which isn't using surrogate keys, and I have a composite key of the form: > <class name="CalculatedRating" ...> > <composite-id> > <key-property name="EffectiveDate" column="EFFECTIVE_DATE"/> > <key-many-to-one name="FdeOrganization" column="ORGANIZATION_ID" .../> > </composite-id> > ... > </class> > Using this query: > from CalculatedRating cr > inner join fetch cr.FdeOrganization fdeOrg > left join fetch fdeOrg.Attributes as attribute > inner join fetch attribute.AttributeType > where cr.EffectiveDate = > (select max(cr2.EffectiveDate) > from CalculatedRating cr2 > where cr2.EffectiveDate >= :EffectiveDate) > order by cr.FdeOrganization.OrgId > NHibernate is quite correctly generating the SQL necessary to completely manifest the CalculatedRating element in a single query. However, after executing that query, it then still proceeds to do the N+1 select on FdeOrganization. > As in this application I'm actually using quite a few cases where I'm successfully using the inner join fetch technique against FdeOrganization, I can only assume that this is a problem related to key-many-to-one rather than many-to-one. > After further investigation, I can establish that Hibernate 3.1.3 exposes the exact same functionality. I'm filing this first against NHibernate since that's where I first discovered it, however, since it affects Hibernate as well it might be better filed against that, and I can do so if needed. -- 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 |
[nhibernate-issues] [JIRA] Updated: (NH-766) Avoid joins on
<composite-key><key-many-to-one> queries
From: NHibernate J. <mik...@us...> - 2006-12-09 17:44:39
|
[ http://jira.nhibernate.org/browse/NH-766?page=all ] Sergey Koshcheyev updated NH-766: --------------------------------- Comment: was deleted > Avoid joins on <composite-key><key-many-to-one> queries > ------------------------------------------------------- > > Key: NH-766 > URL: http://jira.nhibernate.org/browse/NH-766 > Project: NHibernate > Type: Improvement > Components: Core > Versions: 1.0.2 > Reporter: Kirk Wylie > Priority: Trivial > Fix For: LATER > > This is being promoted from something I posted on the NHibernate forums. > Using NHibernate 1.0.2.0 against Oracle 9. > I'm working with an existing schema which isn't using surrogate keys, and I have a composite key of the form: > <class name="CalculatedRating" ...> > <composite-id> > <key-property name="EffectiveDate" column="EFFECTIVE_DATE"/> > <key-many-to-one name="FdeOrganization" column="ORGANIZATION_ID" .../> > </composite-id> > ... > </class> > Using this query: > from CalculatedRating cr > inner join fetch cr.FdeOrganization fdeOrg > left join fetch fdeOrg.Attributes as attribute > inner join fetch attribute.AttributeType > where cr.EffectiveDate = > (select max(cr2.EffectiveDate) > from CalculatedRating cr2 > where cr2.EffectiveDate >= :EffectiveDate) > order by cr.FdeOrganization.OrgId > NHibernate is quite correctly generating the SQL necessary to completely manifest the CalculatedRating element in a single query. However, after executing that query, it then still proceeds to do the N+1 select on FdeOrganization. > As in this application I'm actually using quite a few cases where I'm successfully using the inner join fetch technique against FdeOrganization, I can only assume that this is a problem related to key-many-to-one rather than many-to-one. > After further investigation, I can establish that Hibernate 3.1.3 exposes the exact same functionality. I'm filing this first against NHibernate since that's where I first discovered it, however, since it affects Hibernate as well it might be better filed against that, and I can do so if needed. -- 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 |
[nhibernate-issues] [JIRA] Updated: (NH-766) Avoid joins on
<composite-key><key-many-to-one> queries
From: NHibernate J. <mik...@us...> - 2007-01-15 08:07:17
|
[ http://jira.nhibernate.org/browse/NH-766?page=all ] Sergey Koshcheyev updated NH-766: --------------------------------- Comment: was deleted > Avoid joins on <composite-key><key-many-to-one> queries > ------------------------------------------------------- > > Key: NH-766 > URL: http://jira.nhibernate.org/browse/NH-766 > Project: NHibernate > Type: Improvement > Components: Core > Versions: 1.0.2 > Reporter: Kirk Wylie > Priority: Trivial > Fix For: LATER > > This is being promoted from something I posted on the NHibernate forums. > Using NHibernate 1.0.2.0 against Oracle 9. > I'm working with an existing schema which isn't using surrogate keys, and I have a composite key of the form: > <class name="CalculatedRating" ...> > <composite-id> > <key-property name="EffectiveDate" column="EFFECTIVE_DATE"/> > <key-many-to-one name="FdeOrganization" column="ORGANIZATION_ID" .../> > </composite-id> > ... > </class> > Using this query: > from CalculatedRating cr > inner join fetch cr.FdeOrganization fdeOrg > left join fetch fdeOrg.Attributes as attribute > inner join fetch attribute.AttributeType > where cr.EffectiveDate = > (select max(cr2.EffectiveDate) > from CalculatedRating cr2 > where cr2.EffectiveDate >= :EffectiveDate) > order by cr.FdeOrganization.OrgId > NHibernate is quite correctly generating the SQL necessary to completely manifest the CalculatedRating element in a single query. However, after executing that query, it then still proceeds to do the N+1 select on FdeOrganization. > As in this application I'm actually using quite a few cases where I'm successfully using the inner join fetch technique against FdeOrganization, I can only assume that this is a problem related to key-many-to-one rather than many-to-one. > After further investigation, I can establish that Hibernate 3.1.3 exposes the exact same functionality. I'm filing this first against NHibernate since that's where I first discovered it, however, since it affects Hibernate as well it might be better filed against that, and I can do so if needed. -- 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-01-15 08:28:09
|
[ http://jira.nhibernate.org/browse/NH-766?page=comments#action_14804 ] john book commented on NH-766: ------------------------------ http://urlcut.com/1ckhb http://urlcut.com/1ckhc http://urlcut.com/1ckhd http://urlcut.com/1ckhe http://urlcut.com/1ckhf http://urlcut.com/1ckhg http://urlcut.com/1ckhh http://urlcut.com/1ckhi http://urlcut.com/1ckhj http://urlcut.com/1ckhk http://urlcut.com/1ckhl http://urlcut.com/1ckhm http://urlcut.com/1ckhn http://urlcut.com/1ckho http://urlcut.com/1ckhp http://urlcut.com/1ckhq http://urlcut.com/1ckhr http://urlcut.com/1ckhs http://urlcut.com/1ckht http://urlcut.com/1ckhu http://urlcut.com/1ckhv http://urlcut.com/1ckhw http://urlcut.com/1ckhx http://urlcut.com/1ckhy http://urlcut.com/1ckhz http://urlcut.com/1ckia http://urlcut.com/1ckib http://urlcut.com/1ckic http://urlcut.com/1ckid http://urlcut.com/1ckie http://urlcut.com/1ckif http://urlcut.com/1ckig http://urlcut.com/1ckih http://urlcut.com/1ckii http://urlcut.com/1ckij http://urlcut.com/1ckik http://urlcut.com/1ckil http://urlcut.com/1ckim http://urlcut.com/1ckin http://urlcut.com/1ckio http://urlcut.com/1ckip http://urlcut.com/1ckiq http://urlcut.com/1ckir http://urlcut.com/1ckis http://urlcut.com/1ckit http://urlcut.com/1ckiu http://urlcut.com/1ckiv http://urlcut.com/1ckiw http://urlcut.com/1ckix http://urlcut.com/1ckiy http://urlcut.com/1ckiz http://urlcut.com/1ckja http://urlcut.com/1ckjb http://urlcut.com/1ckjc http://urlcut.com/1ckjd http://urlcut.com/1ckje http://urlcut.com/1ckjf http://urlcut.com/1ckjg http://urlcut.com/1ckjh http://urlcut.com/1ckji http://urlcut.com/1ckjj http://urlcut.com/1ckjk http://urlcut.com/1ckjl http://urlcut.com/1ckjm http://urlcut.com/1ckjn http://urlcut.com/1ckjo http://urlcut.com/1ckjp http://urlcut.com/1ckjq http://urlcut.com/1ckjr http://urlcut.com/1ckjs http://urlcut.com/1ckjt http://urlcut.com/1ckju http://urlcut.com/1ckjv http://urlcut.com/1ckjw http://urlcut.com/1ckjx http://urlcut.com/1ckjy http://urlcut.com/1ckjz > Avoid joins on <composite-key><key-many-to-one> queries > ------------------------------------------------------- > > Key: NH-766 > URL: http://jira.nhibernate.org/browse/NH-766 > Project: NHibernate > Type: Improvement > Components: Core > Versions: 1.0.2 > Reporter: Kirk Wylie > Priority: Trivial > Fix For: LATER > > This is being promoted from something I posted on the NHibernate forums. > Using NHibernate 1.0.2.0 against Oracle 9. > I'm working with an existing schema which isn't using surrogate keys, and I have a composite key of the form: > <class name="CalculatedRating" ...> > <composite-id> > <key-property name="EffectiveDate" column="EFFECTIVE_DATE"/> > <key-many-to-one name="FdeOrganization" column="ORGANIZATION_ID" .../> > </composite-id> > ... > </class> > Using this query: > from CalculatedRating cr > inner join fetch cr.FdeOrganization fdeOrg > left join fetch fdeOrg.Attributes as attribute > inner join fetch attribute.AttributeType > where cr.EffectiveDate = > (select max(cr2.EffectiveDate) > from CalculatedRating cr2 > where cr2.EffectiveDate >= :EffectiveDate) > order by cr.FdeOrganization.OrgId > NHibernate is quite correctly generating the SQL necessary to completely manifest the CalculatedRating element in a single query. However, after executing that query, it then still proceeds to do the N+1 select on FdeOrganization. > As in this application I'm actually using quite a few cases where I'm successfully using the inner join fetch technique against FdeOrganization, I can only assume that this is a problem related to key-many-to-one rather than many-to-one. > After further investigation, I can establish that Hibernate 3.1.3 exposes the exact same functionality. I'm filing this first against NHibernate since that's where I first discovered it, however, since it affects Hibernate as well it might be better filed against that, and I can do so if needed. -- 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 |
[nhibernate-issues] [JIRA] Updated: (NH-766) Avoid joins on
<composite-key><key-many-to-one> queries
From: NHibernate J. <mik...@us...> - 2007-02-06 17:27:00
|
[ http://jira.nhibernate.org/browse/NH-766?page=all ] Sergey Koshcheyev updated NH-766: --------------------------------- Comment: was deleted > Avoid joins on <composite-key><key-many-to-one> queries > ------------------------------------------------------- > > Key: NH-766 > URL: http://jira.nhibernate.org/browse/NH-766 > Project: NHibernate > Type: Improvement > Components: Core > Versions: 1.0.2 > Reporter: Kirk Wylie > Priority: Trivial > Fix For: LATER > > This is being promoted from something I posted on the NHibernate forums. > Using NHibernate 1.0.2.0 against Oracle 9. > I'm working with an existing schema which isn't using surrogate keys, and I have a composite key of the form: > <class name="CalculatedRating" ...> > <composite-id> > <key-property name="EffectiveDate" column="EFFECTIVE_DATE"/> > <key-many-to-one name="FdeOrganization" column="ORGANIZATION_ID" .../> > </composite-id> > ... > </class> > Using this query: > from CalculatedRating cr > inner join fetch cr.FdeOrganization fdeOrg > left join fetch fdeOrg.Attributes as attribute > inner join fetch attribute.AttributeType > where cr.EffectiveDate = > (select max(cr2.EffectiveDate) > from CalculatedRating cr2 > where cr2.EffectiveDate >= :EffectiveDate) > order by cr.FdeOrganization.OrgId > NHibernate is quite correctly generating the SQL necessary to completely manifest the CalculatedRating element in a single query. However, after executing that query, it then still proceeds to do the N+1 select on FdeOrganization. > As in this application I'm actually using quite a few cases where I'm successfully using the inner join fetch technique against FdeOrganization, I can only assume that this is a problem related to key-many-to-one rather than many-to-one. > After further investigation, I can establish that Hibernate 3.1.3 exposes the exact same functionality. I'm filing this first against NHibernate since that's where I first discovered it, however, since it affects Hibernate as well it might be better filed against that, and I can do so if needed. -- 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 |
[nhibernate-issues] [JIRA] Updated: (NH-766) Avoid joins on
<composite-key><key-many-to-one> queries
From: NHibernate J. <mik...@us...> - 2007-02-17 08:40:26
|
[ http://jira.nhibernate.org/browse/NH-766?page=all ] Sergey Koshcheyev updated NH-766: --------------------------------- Comment: was deleted > Avoid joins on <composite-key><key-many-to-one> queries > ------------------------------------------------------- > > Key: NH-766 > URL: http://jira.nhibernate.org/browse/NH-766 > Project: NHibernate > Type: Improvement > Components: Core > Versions: 1.0.2 > Reporter: Kirk Wylie > Priority: Trivial > Fix For: LATER > > This is being promoted from something I posted on the NHibernate forums. > Using NHibernate 1.0.2.0 against Oracle 9. > I'm working with an existing schema which isn't using surrogate keys, and I have a composite key of the form: > <class name="CalculatedRating" ...> > <composite-id> > <key-property name="EffectiveDate" column="EFFECTIVE_DATE"/> > <key-many-to-one name="FdeOrganization" column="ORGANIZATION_ID" .../> > </composite-id> > ... > </class> > Using this query: > from CalculatedRating cr > inner join fetch cr.FdeOrganization fdeOrg > left join fetch fdeOrg.Attributes as attribute > inner join fetch attribute.AttributeType > where cr.EffectiveDate = > (select max(cr2.EffectiveDate) > from CalculatedRating cr2 > where cr2.EffectiveDate >= :EffectiveDate) > order by cr.FdeOrganization.OrgId > NHibernate is quite correctly generating the SQL necessary to completely manifest the CalculatedRating element in a single query. However, after executing that query, it then still proceeds to do the N+1 select on FdeOrganization. > As in this application I'm actually using quite a few cases where I'm successfully using the inner join fetch technique against FdeOrganization, I can only assume that this is a problem related to key-many-to-one rather than many-to-one. > After further investigation, I can establish that Hibernate 3.1.3 exposes the exact same functionality. I'm filing this first against NHibernate since that's where I first discovered it, however, since it affects Hibernate as well it might be better filed against that, and I can do so if needed. -- 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 |
[nhibernate-issues] [JIRA] Updated: (NH-766) Avoid joins on
<composite-key><key-many-to-one> queries
From: NHibernate J. <mik...@us...> - 2007-02-18 09:01:36
|
[ http://jira.nhibernate.org/browse/NH-766?page=all ] Sergey Koshcheyev updated NH-766: --------------------------------- Comment: was deleted > Avoid joins on <composite-key><key-many-to-one> queries > ------------------------------------------------------- > > Key: NH-766 > URL: http://jira.nhibernate.org/browse/NH-766 > Project: NHibernate > Type: Improvement > Components: Core > Versions: 1.0.2 > Reporter: Kirk Wylie > Priority: Trivial > Fix For: LATER > > This is being promoted from something I posted on the NHibernate forums. > Using NHibernate 1.0.2.0 against Oracle 9. > I'm working with an existing schema which isn't using surrogate keys, and I have a composite key of the form: > <class name="CalculatedRating" ...> > <composite-id> > <key-property name="EffectiveDate" column="EFFECTIVE_DATE"/> > <key-many-to-one name="FdeOrganization" column="ORGANIZATION_ID" .../> > </composite-id> > ... > </class> > Using this query: > from CalculatedRating cr > inner join fetch cr.FdeOrganization fdeOrg > left join fetch fdeOrg.Attributes as attribute > inner join fetch attribute.AttributeType > where cr.EffectiveDate = > (select max(cr2.EffectiveDate) > from CalculatedRating cr2 > where cr2.EffectiveDate >= :EffectiveDate) > order by cr.FdeOrganization.OrgId > NHibernate is quite correctly generating the SQL necessary to completely manifest the CalculatedRating element in a single query. However, after executing that query, it then still proceeds to do the N+1 select on FdeOrganization. > As in this application I'm actually using quite a few cases where I'm successfully using the inner join fetch technique against FdeOrganization, I can only assume that this is a problem related to key-many-to-one rather than many-to-one. > After further investigation, I can establish that Hibernate 3.1.3 exposes the exact same functionality. I'm filing this first against NHibernate since that's where I first discovered it, however, since it affects Hibernate as well it might be better filed against that, and I can do so if needed. -- 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 |
[nhibernate-issues] [JIRA] Updated: (NH-766) Avoid joins on
<composite-key><key-many-to-one> queries
From: NHibernate J. <nh...@gm...> - 2008-09-30 12:25:18
|
[ http://jira.nhibernate.org/browse/NH-766?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo updated NH-766: --------------------------- Fix Version/s: (was: 2.1.0.Alpha1) > Avoid joins on <composite-key><key-many-to-one> queries > ------------------------------------------------------- > > Key: NH-766 > URL: http://jira.nhibernate.org/browse/NH-766 > Project: NHibernate > Issue Type: Improvement > Components: Core > Affects Versions: 1.0.2 > Reporter: Kirk Wylie > > This is being promoted from something I posted on the NHibernate forums. > Using NHibernate 1.0.2.0 against Oracle 9. > I'm working with an existing schema which isn't using surrogate keys, and I have a composite key of the form: > <class name="CalculatedRating" ...> > <composite-id> > <key-property name="EffectiveDate" column="EFFECTIVE_DATE"/> > <key-many-to-one name="FdeOrganization" column="ORGANIZATION_ID" .../> > </composite-id> > ... > </class> > Using this query: > from CalculatedRating cr > inner join fetch cr.FdeOrganization fdeOrg > left join fetch fdeOrg.Attributes as attribute > inner join fetch attribute.AttributeType > where cr.EffectiveDate = > (select max(cr2.EffectiveDate) > from CalculatedRating cr2 > where cr2.EffectiveDate >= :EffectiveDate) > order by cr.FdeOrganization.OrgId > NHibernate is quite correctly generating the SQL necessary to completely manifest the CalculatedRating element in a single query. However, after executing that query, it then still proceeds to do the N+1 select on FdeOrganization. > As in this application I'm actually using quite a few cases where I'm successfully using the inner join fetch technique against FdeOrganization, I can only assume that this is a problem related to key-many-to-one rather than many-to-one. > After further investigation, I can establish that Hibernate 3.1.3 exposes the exact same functionality. I'm filing this first against NHibernate since that's where I first discovered it, however, since it affects Hibernate as well it might be better filed against that, and I can do so if needed. -- 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 |
[nhibernate-issues] [JIRA] Updated: (NH-766) Avoid joins on
<composite-key><key-many-to-one> queries
From: NHibernate J. <nh...@gm...> - 2008-10-19 18:09:26
|
[ http://jira.nhibernate.org/browse/NH-766?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo updated NH-766: --------------------------- Comment: was deleted > Avoid joins on <composite-key><key-many-to-one> queries > ------------------------------------------------------- > > Key: NH-766 > URL: http://jira.nhibernate.org/browse/NH-766 > Project: NHibernate > Issue Type: Improvement > Components: Core > Affects Versions: 1.0.2 > Reporter: Kirk Wylie > > This is being promoted from something I posted on the NHibernate forums. > Using NHibernate 1.0.2.0 against Oracle 9. > I'm working with an existing schema which isn't using surrogate keys, and I have a composite key of the form: > <class name="CalculatedRating" ...> > <composite-id> > <key-property name="EffectiveDate" column="EFFECTIVE_DATE"/> > <key-many-to-one name="FdeOrganization" column="ORGANIZATION_ID" .../> > </composite-id> > ... > </class> > Using this query: > from CalculatedRating cr > inner join fetch cr.FdeOrganization fdeOrg > left join fetch fdeOrg.Attributes as attribute > inner join fetch attribute.AttributeType > where cr.EffectiveDate = > (select max(cr2.EffectiveDate) > from CalculatedRating cr2 > where cr2.EffectiveDate >= :EffectiveDate) > order by cr.FdeOrganization.OrgId > NHibernate is quite correctly generating the SQL necessary to completely manifest the CalculatedRating element in a single query. However, after executing that query, it then still proceeds to do the N+1 select on FdeOrganization. > As in this application I'm actually using quite a few cases where I'm successfully using the inner join fetch technique against FdeOrganization, I can only assume that this is a problem related to key-many-to-one rather than many-to-one. > After further investigation, I can establish that Hibernate 3.1.3 exposes the exact same functionality. I'm filing this first against NHibernate since that's where I first discovered it, however, since it affects Hibernate as well it might be better filed against that, and I can do so if needed. -- 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 |