From: NHibernate J. <mik...@us...> - 2007-08-10 08:11:06
|
Query cache does not work when using Criteria API to create a projection qu= ery with a result transformer ---------------------------------------------------------------------------= ----------------------------- Key: NH-1090 URL: http://jira.nhibernate.org/browse/NH-1090 Project: NHibernate Issue Type: Bug Components: Core Affects Versions: 1.2.0.GA, 2.0.0.Alpha1, LATER Reporter: Olli Ryh=C3=A4nen Priority: Major Enabling query-cache on a projection query with a result transformer attach= ed using Criteria API, will fail with an exception: "System.InvalidCastException: Unable to cast object of type '<The output ty= pe from the result transformer' to type 'System.Object[]'" The exception is caused by the line: "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnT= ypes, session ) );" in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to ca= st the "result[i]" to an "object[]". Using result transformers the result set has already been transformed to th= e transformed type, before adding to the cache, so casting to "object[]" wi= ll fail. (The transformation is done in the method "GetResultColumnOrRow" i= n CriteriaLoader.cs on line 74, which gets called in process of loading the= result set from the database). To reproduce the issue, turn on caching on any of the projection query test= s with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 IList resultWithAliasedBean =3D s.CreateCriteria(typeof (Enrolment)) .CreateAlias("Student", "st") .CreateAlias("Course", "co") .SetProjection(Projections.ProjectionList() .Add(Projections.Property("st.Name"), "studentName") .Add(Projections.Property("co.Description"), "courseDescription") ) .AddOrder(Order.Desc("studentName")) .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) .SetCacheable(true) .List(); A simple fix would be to check if the type of "result[i]" is an "object[]" = before adding to the cache and cache non "object[]" types as is to the cach= e (and do the same check when getting the items back from the cache), but I= 'm not sure if that would break the caching architecture in some way.=20 --=20 This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= p://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2007-09-21 21:37:58
|
[ http://jira.nhibernate.org/browse/NH-1090?page=3Dcom.atlassian.jira.= plugin.system.issuetabpanels:all-tabpanel ] Sergey Koshcheyev updated NH-1090: ---------------------------------- Affects Version/s: (was: 2.0.0.Alpha1) (was: LATER) Fix Version/s: 1.2.1 > Query cache does not work when using Criteria API to create a projection = query with a result transformer > -------------------------------------------------------------------------= ------------------------------- > > Key: NH-1090 > URL: http://jira.nhibernate.org/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA > Reporter: Olli Ryh=C3=A4nen > Priority: Major > Fix For: 1.2.1 > > > Enabling query-cache on a projection query with a result transformer atta= ched using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output = type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], retur= nTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to = cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to = the transformed type, before adding to the cache, so casting to "object[]" = will fail. (The transformation is done in the method "GetResultColumnOrRow"= in CriteriaLoader.cs on line 74, which gets called in process of loading t= he result set from the database). > To reproduce the issue, turn on caching on any of the projection query te= sts with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean =3D s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription"= ) > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]= " before adding to the cache and cache non "object[]" types as is to the ca= che (and do the same check when getting the items back from the cache), but= I'm not sure if that would break the caching architecture in some way.=20 --=20 This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= p://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2007-11-18 16:22:56
|
[ http://jira.nhibernate.org/browse/NH-1090?page=3Dcom.atlassian.jira.= plugin.system.issuetabpanels:all-tabpanel ] Sergey Koshcheyev updated NH-1090: ---------------------------------- Fix Version/s: (was: 1.2.1) LATER > Query cache does not work when using Criteria API to create a projection = query with a result transformer > -------------------------------------------------------------------------= ------------------------------- > > Key: NH-1090 > URL: http://jira.nhibernate.org/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA > Reporter: Olli Ryh=C3=A4nen > Priority: Major > Fix For: LATER > > > Enabling query-cache on a projection query with a result transformer atta= ched using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output = type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], retur= nTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to = cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to = the transformed type, before adding to the cache, so casting to "object[]" = will fail. (The transformation is done in the method "GetResultColumnOrRow"= in CriteriaLoader.cs on line 74, which gets called in process of loading t= he result set from the database). > To reproduce the issue, turn on caching on any of the projection query te= sts with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean =3D s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription"= ) > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]= " before adding to the cache and cache non "object[]" types as is to the ca= che (and do the same check when getting the items back from the cache), but= I'm not sure if that would break the caching architecture in some way.=20 --=20 This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= p://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <nh...@gm...> - 2008-06-15 18:15:43
|
[ http://jira.nhibernate.org/browse/NH-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo updated NH-1090: ---------------------------- Fix Version/s: (was: 2.0.0.Alpha2) 2.0.0.Beta1 > Query cache does not work when using Criteria API to create a projection query with a result transformer > -------------------------------------------------------------------------------------------------------- > > Key: NH-1090 > URL: http://jira.nhibernate.org/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA > Reporter: Olli Ryhänen > Priority: Major > Fix For: 2.0.0.Beta1 > > > Enabling query-cache on a projection query with a result transformer attached using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to the transformed type, before adding to the cache, so casting to "object[]" will fail. (The transformation is done in the method "GetResultColumnOrRow" in CriteriaLoader.cs on line 74, which gets called in process of loading the result set from the database). > To reproduce the issue, turn on caching on any of the projection query tests with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean = s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription") > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]" before adding to the cache and cache non "object[]" types as is to the cache (and do the same check when getting the items back from the cache), but I'm not sure if that would break the caching architecture in some way. -- 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. <nh...@gm...> - 2008-06-29 20:55:35
|
[ http://jira.nhibernate.org/browse/NH-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo updated NH-1090: ---------------------------- Fix Version/s: (was: 2.0.0.Beta1) 2.0.0.Beta2 > Query cache does not work when using Criteria API to create a projection query with a result transformer > -------------------------------------------------------------------------------------------------------- > > Key: NH-1090 > URL: http://jira.nhibernate.org/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA > Reporter: Olli Ryhänen > Priority: Major > Fix For: 2.0.0.Beta2 > > > Enabling query-cache on a projection query with a result transformer attached using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to the transformed type, before adding to the cache, so casting to "object[]" will fail. (The transformation is done in the method "GetResultColumnOrRow" in CriteriaLoader.cs on line 74, which gets called in process of loading the result set from the database). > To reproduce the issue, turn on caching on any of the projection query tests with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean = s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription") > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]" before adding to the cache and cache non "object[]" types as is to the cache (and do the same check when getting the items back from the cache), but I'm not sure if that would break the caching architecture in some way. -- 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. <nh...@gm...> - 2008-09-30 12:33:31
|
[ http://jira.nhibernate.org/browse/NH-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo updated NH-1090: ---------------------------- Fix Version/s: (was: 2.1.0.Alpha1) > Query cache does not work when using Criteria API to create a projection query with a result transformer > -------------------------------------------------------------------------------------------------------- > > Key: NH-1090 > URL: http://jira.nhibernate.org/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA > Reporter: Olli Ryhänen > Priority: Major > > Enabling query-cache on a projection query with a result transformer attached using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to the transformed type, before adding to the cache, so casting to "object[]" will fail. (The transformation is done in the method "GetResultColumnOrRow" in CriteriaLoader.cs on line 74, which gets called in process of loading the result set from the database). > To reproduce the issue, turn on caching on any of the projection query tests with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean = s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription") > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]" before adding to the cache and cache non "object[]" types as is to the cache (and do the same check when getting the items back from the cache), but I'm not sure if that would break the caching architecture in some way. -- 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. <nh...@gm...> - 2008-10-13 19:16:32
|
[ http://jira.nhibernate.org/browse/NH-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17042#action_17042 ] Tuna Toksoz commented on NH-1090: --------------------------------- I was able to reproduce the issue. Still on the trunk. > Query cache does not work when using Criteria API to create a projection query with a result transformer > -------------------------------------------------------------------------------------------------------- > > Key: NH-1090 > URL: http://jira.nhibernate.org/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA > Reporter: Olli Ryhänen > Priority: Major > > Enabling query-cache on a projection query with a result transformer attached using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to the transformed type, before adding to the cache, so casting to "object[]" will fail. (The transformation is done in the method "GetResultColumnOrRow" in CriteriaLoader.cs on line 74, which gets called in process of loading the result set from the database). > To reproduce the issue, turn on caching on any of the projection query tests with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean = s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription") > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]" before adding to the cache and cache non "object[]" types as is to the cache (and do the same check when getting the items back from the cache), but I'm not sure if that would break the caching architecture in some way. -- 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. <nh...@gm...> - 2008-10-13 19:19:23
|
[ http://jira.nhibernate.org/browse/NH-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tuna Toksoz updated NH-1090: ---------------------------- Affects Version/s: 1.2.1 2.0.0.GA 2.0.1.GA > Query cache does not work when using Criteria API to create a projection query with a result transformer > -------------------------------------------------------------------------------------------------------- > > Key: NH-1090 > URL: http://jira.nhibernate.org/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA, 1.2.1, 2.0.0.GA, 2.0.1.GA > Reporter: Olli Ryhänen > Priority: Major > > Enabling query-cache on a projection query with a result transformer attached using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to the transformed type, before adding to the cache, so casting to "object[]" will fail. (The transformation is done in the method "GetResultColumnOrRow" in CriteriaLoader.cs on line 74, which gets called in process of loading the result set from the database). > To reproduce the issue, turn on caching on any of the projection query tests with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean = s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription") > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]" before adding to the cache and cache non "object[]" types as is to the cache (and do the same check when getting the items back from the cache), but I'm not sure if that would break the caching architecture in some way. -- 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. <nh...@gm...> - 2008-10-13 20:24:25
|
[ http://jira.nhibernate.org/browse/NH-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tuna Toksoz reassigned NH-1090: ------------------------------- Assignee: Tuna Toksoz > Query cache does not work when using Criteria API to create a projection query with a result transformer > -------------------------------------------------------------------------------------------------------- > > Key: NH-1090 > URL: http://jira.nhibernate.org/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA, 1.2.1, 2.0.0.GA, 2.0.1.GA > Reporter: Olli Ryhänen > Assignee: Tuna Toksoz > Priority: Major > > Enabling query-cache on a projection query with a result transformer attached using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to the transformed type, before adding to the cache, so casting to "object[]" will fail. (The transformation is done in the method "GetResultColumnOrRow" in CriteriaLoader.cs on line 74, which gets called in process of loading the result set from the database). > To reproduce the issue, turn on caching on any of the projection query tests with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean = s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription") > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]" before adding to the cache and cache non "object[]" types as is to the cache (and do the same check when getting the items back from the cache), but I'm not sure if that would break the caching architecture in some way. -- 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. <nh...@gm...> - 2008-10-21 17:34:25
|
[ http://jira.nhibernate.org/browse/NH-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17086#action_17086 ] Tuna Toksoz commented on NH-1090: --------------------------------- I have fixed it in my local copy, it needed a modification to MultiQuery Tests. Will commit when i make sure if it is right. > Query cache does not work when using Criteria API to create a projection query with a result transformer > -------------------------------------------------------------------------------------------------------- > > Key: NH-1090 > URL: http://jira.nhibernate.org/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA, 1.2.1, 2.0.0.GA, 2.0.1.GA > Reporter: Olli Ryhänen > Assignee: Tuna Toksoz > Priority: Major > > Enabling query-cache on a projection query with a result transformer attached using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to the transformed type, before adding to the cache, so casting to "object[]" will fail. (The transformation is done in the method "GetResultColumnOrRow" in CriteriaLoader.cs on line 74, which gets called in process of loading the result set from the database). > To reproduce the issue, turn on caching on any of the projection query tests with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean = s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription") > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]" before adding to the cache and cache non "object[]" types as is to the cache (and do the same check when getting the items back from the cache), but I'm not sure if that would break the caching architecture in some way. -- 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. <nh...@gm...> - 2008-10-21 18:53:36
|
[ http://jira.nhibernate.org/browse/NH-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tuna Toksoz closed NH-1090. --------------------------- Resolution: Fixed Fix Version/s: 2.1.0.Alpha1 Fixed in rev 3871 > Query cache does not work when using Criteria API to create a projection query with a result transformer > -------------------------------------------------------------------------------------------------------- > > Key: NH-1090 > URL: http://jira.nhibernate.org/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA, 1.2.1, 2.0.0.GA, 2.0.1.GA > Reporter: Olli Ryhänen > Assignee: Tuna Toksoz > Priority: Major > Fix For: 2.1.0.Alpha1 > > > Enabling query-cache on a projection query with a result transformer attached using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to the transformed type, before adding to the cache, so casting to "object[]" will fail. (The transformation is done in the method "GetResultColumnOrRow" in CriteriaLoader.cs on line 74, which gets called in process of loading the result set from the database). > To reproduce the issue, turn on caching on any of the projection query tests with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean = s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription") > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]" before adding to the cache and cache non "object[]" types as is to the cache (and do the same check when getting the items back from the cache), but I'm not sure if that would break the caching architecture in some way. -- 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. <nh...@gm...> - 2008-10-24 17:50:51
|
[ http://jira.nhibernate.org/browse/NH-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tuna Toksoz reopened NH-1090: ----------------------------- Looks like it is still problematic, investigating. > Query cache does not work when using Criteria API to create a projection query with a result transformer > -------------------------------------------------------------------------------------------------------- > > Key: NH-1090 > URL: http://jira.nhibernate.org/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA, 1.2.1, 2.0.0.GA, 2.0.1.GA > Reporter: Olli Ryhänen > Assignee: Tuna Toksoz > Priority: Major > Fix For: 2.1.0.Alpha1 > > > Enabling query-cache on a projection query with a result transformer attached using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to the transformed type, before adding to the cache, so casting to "object[]" will fail. (The transformation is done in the method "GetResultColumnOrRow" in CriteriaLoader.cs on line 74, which gets called in process of loading the result set from the database). > To reproduce the issue, turn on caching on any of the projection query tests with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean = s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription") > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]" before adding to the cache and cache non "object[]" types as is to the cache (and do the same check when getting the items back from the cache), but I'm not sure if that would break the caching architecture in some way. -- 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. <nh...@gm...> - 2008-10-24 18:01:09
|
[ http://jira.nhibernate.org/browse/NH-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jesse updated NH-1090: ---------------------- Attachment: NH1090-sideeffect.zip After the original patch was applied it created another bug. This bug produces an an error when a criteria query is cached, the result transformer is set to DistinctRootEntity and the results contain an eagerly loaded association. I have supplied a test case that produces the bug. The test case passes if the original patch is rolled back. > Query cache does not work when using Criteria API to create a projection query with a result transformer > -------------------------------------------------------------------------------------------------------- > > Key: NH-1090 > URL: http://jira.nhibernate.org/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA, 1.2.1, 2.0.0.GA, 2.0.1.GA > Reporter: Olli Ryhänen > Assignee: Tuna Toksoz > Priority: Major > Fix For: 2.1.0.Alpha1 > > Attachments: NH1090-sideeffect.zip > > > Enabling query-cache on a projection query with a result transformer attached using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to the transformed type, before adding to the cache, so casting to "object[]" will fail. (The transformation is done in the method "GetResultColumnOrRow" in CriteriaLoader.cs on line 74, which gets called in process of loading the result set from the database). > To reproduce the issue, turn on caching on any of the projection query tests with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean = s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription") > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]" before adding to the cache and cache non "object[]" types as is to the cache (and do the same check when getting the items back from the cache), but I'm not sure if that would break the caching architecture in some way. -- 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. <nh...@gm...> - 2009-02-07 16:42:54
|
[ http://jira.nhibernate.org/browse/NH-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo updated NH-1090: ---------------------------- Fix Version/s: (was: 2.1.0.Alpha1) > Query cache does not work when using Criteria API to create a projection query with a result transformer > -------------------------------------------------------------------------------------------------------- > > Key: NH-1090 > URL: http://jira.nhibernate.org/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA, 1.2.1, 2.0.0.GA, 2.0.1.GA > Reporter: Olli Ryhänen > Assignee: Tuna Toksoz > Priority: Major > Attachments: NH1090-sideeffect.zip > > > Enabling query-cache on a projection query with a result transformer attached using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to the transformed type, before adding to the cache, so casting to "object[]" will fail. (The transformation is done in the method "GetResultColumnOrRow" in CriteriaLoader.cs on line 74, which gets called in process of loading the result set from the database). > To reproduce the issue, turn on caching on any of the projection query tests with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean = s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription") > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]" before adding to the cache and cache non "object[]" types as is to the cache (and do the same check when getting the items back from the cache), but I'm not sure if that would break the caching architecture in some way. -- 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. <nh...@gm...> - 2009-03-01 12:20:45
|
[ http://nhjira.koah.net/browse/NH-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tuna Toksoz reassigned NH-1090: ------------------------------- Assignee: (was: Tuna Toksoz) > Query cache does not work when using Criteria API to create a projection query with a result transformer > -------------------------------------------------------------------------------------------------------- > > Key: NH-1090 > URL: http://nhjira.koah.net/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA, 1.2.1, 2.0.0.GA, 2.0.1.GA > Reporter: Olli Ryhänen > Priority: Major > Attachments: NH1090-sideeffect.zip > > > Enabling query-cache on a projection query with a result transformer attached using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to the transformed type, before adding to the cache, so casting to "object[]" will fail. (The transformation is done in the method "GetResultColumnOrRow" in CriteriaLoader.cs on line 74, which gets called in process of loading the result set from the database). > To reproduce the issue, turn on caching on any of the projection query tests with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean = s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription") > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]" before adding to the cache and cache non "object[]" types as is to the cache (and do the same check when getting the items back from the cache), but I'm not sure if that would break the caching architecture in some way. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://nhjira.koah.net/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <nh...@gm...> - 2009-12-17 19:16:49
|
[ http://nhjira.koah.net/browse/NH-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18924#action_18924 ] Rob Gibbens commented on NH-1090: --------------------------------- It appears that this is still a problem. Are there any plans to continue work on it? > Query cache does not work when using Criteria API to create a projection query with a result transformer > -------------------------------------------------------------------------------------------------------- > > Key: NH-1090 > URL: http://nhjira.koah.net/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA, 1.2.1, 2.0.0.GA, 2.0.1.GA > Reporter: Olli Ryhänen > Priority: Major > Attachments: NH1090-sideeffect.zip > > > Enabling query-cache on a projection query with a result transformer attached using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to the transformed type, before adding to the cache, so casting to "object[]" will fail. (The transformation is done in the method "GetResultColumnOrRow" in CriteriaLoader.cs on line 74, which gets called in process of loading the result set from the database). > To reproduce the issue, turn on caching on any of the projection query tests with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean = s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription") > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]" before adding to the cache and cache non "object[]" types as is to the cache (and do the same check when getting the items back from the cache), but I'm not sure if that would break the caching architecture in some way. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://nhjira.koah.net/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <nh...@gm...> - 2009-12-22 07:20:38
|
[ http://nhjira.koah.net/browse/NH-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18932#action_18932 ] Silver Sepp commented on NH-1090: --------------------------------- I'm wondering the same thing. In Linq to Nhib its so easy to use projections (select anonymous type) so this bug is pretty big if it still exists IMO. I'm using 2.1.0.4000 and can report that the original description applies to my version. > Query cache does not work when using Criteria API to create a projection query with a result transformer > -------------------------------------------------------------------------------------------------------- > > Key: NH-1090 > URL: http://nhjira.koah.net/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA, 1.2.1, 2.0.0.GA, 2.0.1.GA > Reporter: Olli Ryhänen > Priority: Major > Attachments: NH1090-sideeffect.zip > > > Enabling query-cache on a projection query with a result transformer attached using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to the transformed type, before adding to the cache, so casting to "object[]" will fail. (The transformation is done in the method "GetResultColumnOrRow" in CriteriaLoader.cs on line 74, which gets called in process of loading the result set from the database). > To reproduce the issue, turn on caching on any of the projection query tests with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean = s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription") > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]" before adding to the cache and cache non "object[]" types as is to the cache (and do the same check when getting the items back from the cache), but I'm not sure if that would break the caching architecture in some way. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://nhjira.koah.net/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Fabio M. (JIRA) <nh...@gm...> - 2011-05-02 14:09:47
|
[ http://216.121.112.228/browse/NH-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo resolved NH-1090. ----------------------------- Resolution: Fixed Fix Version/s: 3.2.0Alpha3 > Query cache does not work when using Criteria API to create a projection query with a result transformer > -------------------------------------------------------------------------------------------------------- > > Key: NH-1090 > URL: http://216.121.112.228/browse/NH-1090 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 1.2.0.GA, 1.2.1, 2.0.0.GA, 2.0.1.GA > Reporter: Olli Ryhänen > Priority: Major > Fix For: 3.2.0Alpha3 > > Attachments: NH1090-sideeffect.zip > > > Enabling query-cache on a projection query with a result transformer attached using Criteria API, will fail with an exception: > "System.InvalidCastException: Unable to cast object of type '<The output type from the result transformer' to type 'System.Object[]'" > The exception is caused by the line: > "cacheable.Add( TypeFactory.Disassemble( ( object[ ] ) result[ i ], returnTypes, session ) );" > in "NHibernate\Cache\StandardQueryCache.cs" on line 63, when it tries to cast the "result[i]" to an "object[]". > Using result transformers the result set has already been transformed to the transformed type, before adding to the cache, so casting to "object[]" will fail. (The transformation is done in the method "GetResultColumnOrRow" in CriteriaLoader.cs on line 74, which gets called in process of loading the result set from the database). > To reproduce the issue, turn on caching on any of the projection query tests with result transformer in "CriteriaQueryTests.cs". E.g. on line 494 > IList resultWithAliasedBean = s.CreateCriteria(typeof (Enrolment)) > .CreateAlias("Student", "st") > .CreateAlias("Course", "co") > .SetProjection(Projections.ProjectionList() > .Add(Projections.Property("st.Name"), "studentName") > .Add(Projections.Property("co.Description"), "courseDescription") > ) > .AddOrder(Order.Desc("studentName")) > .SetResultTransformer(Transformers.AliasToBean(typeof (StudentDTO))) > .SetCacheable(true) > .List(); > A simple fix would be to check if the type of "result[i]" is an "object[]" before adding to the cache and cache non "object[]" types as is to the cache (and do the same check when getting the items back from the cache), but I'm not sure if that would break the caching architecture in some way. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |