From: NHibernate J. <mik...@us...> - 2006-12-18 14:02:34
|
Error using Limits with DB2400Dialect ------------------------------------- Key: NH-837 URL: http://jira.nhibernate.org/browse/NH-837 Project: NHibernate Type: Bug Components: Data Providers Versions: 1.2.0.Beta2 Reporter: Christophe Vigouroux Using with DB2400Dialect : query.SetFirstResult(startRow); query.SetMaxResults(maxRows); IList<Core.Imprimante> retour = query.List<Core.Imprimante>(); results in the generation of the following SQL statement : select * from (select rownumber() over() as rownum, this_.CDIMPLOG as CDIMPLOG0_0_, this_.CDSOC as CDSOC0_0_, this_.LBIMP as LBIMP0_0_ FROM TIMPRIM this_) as tempresult where rownum <= ? This statement is for use with DB2 UDB, but not compatible with DB2 for iSeries. The statement should use RRN(table) instead of rownumber() and use "fetch first n rows" instead of over(). DB2400Dialect should override GetLimitString of DB2Dialect to provide with functionality. Thanks for your support ! -- 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-12-18 14:05:37
|
[ http://jira.nhibernate.org/browse/NH-837?page=comments#action_14622 ] Sergey Koshcheyev commented on NH-837: -------------------------------------- Can you provide the required changes in form of a patch? I don't have access to DB2 so I can't add and test this myself. > Error using Limits with DB2400Dialect > ------------------------------------- > > Key: NH-837 > URL: http://jira.nhibernate.org/browse/NH-837 > Project: NHibernate > Type: Bug > Components: Data Providers > Versions: 1.2.0.Beta2 > Reporter: Christophe Vigouroux > > Using with DB2400Dialect : > query.SetFirstResult(startRow); > query.SetMaxResults(maxRows); > IList<Core.Imprimante> retour = query.List<Core.Imprimante>(); > results in the generation of the following SQL statement : > select * from (select rownumber() over() as rownum, this_.CDIMPLOG as CDIMPLOG0_0_, this_.CDSOC as CDSOC0_0_, this_.LBIMP as LBIMP0_0_ FROM TIMPRIM this_) as tempresult where rownum <= ? > This statement is for use with DB2 UDB, but not compatible with DB2 for iSeries. > The statement should use RRN(table) instead of rownumber() and use "fetch first n rows" instead of over(). > DB2400Dialect should override GetLimitString of DB2Dialect to provide with functionality. > Thanks for your support ! -- 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-12-18 14:17:35
|
[ http://jira.nhibernate.org/browse/NH-837?page=comments#action_14623 ] Christophe Vigouroux commented on NH-837: ----------------------------------------- Ok I can try to do this. > Error using Limits with DB2400Dialect > ------------------------------------- > > Key: NH-837 > URL: http://jira.nhibernate.org/browse/NH-837 > Project: NHibernate > Type: Bug > Components: Data Providers > Versions: 1.2.0.Beta2 > Reporter: Christophe Vigouroux > > Using with DB2400Dialect : > query.SetFirstResult(startRow); > query.SetMaxResults(maxRows); > IList<Core.Imprimante> retour = query.List<Core.Imprimante>(); > results in the generation of the following SQL statement : > select * from (select rownumber() over() as rownum, this_.CDIMPLOG as CDIMPLOG0_0_, this_.CDSOC as CDSOC0_0_, this_.LBIMP as LBIMP0_0_ FROM TIMPRIM this_) as tempresult where rownum <= ? > This statement is for use with DB2 UDB, but not compatible with DB2 for iSeries. > The statement should use RRN(table) instead of rownumber() and use "fetch first n rows" instead of over(). > DB2400Dialect should override GetLimitString of DB2Dialect to provide with functionality. > Thanks for your support ! -- 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-12-18 15:06:35
|
[ http://jira.nhibernate.org/browse/NH-837?page=comments#action_14624 ] Christophe Vigouroux commented on NH-837: ----------------------------------------- Obviously RRN() is not an equivalent to Row_Number. It returns a "relative" row number and cannot be used because it doesn't return the row number of the result set, only the row number of the physical table. I don't know any way to get the row number of the result set, or any other way to ask DB2/400 to fetch the rows starting from an offet... > Error using Limits with DB2400Dialect > ------------------------------------- > > Key: NH-837 > URL: http://jira.nhibernate.org/browse/NH-837 > Project: NHibernate > Type: Bug > Components: Data Providers > Versions: 1.2.0.Beta2 > Reporter: Christophe Vigouroux > > Using with DB2400Dialect : > query.SetFirstResult(startRow); > query.SetMaxResults(maxRows); > IList<Core.Imprimante> retour = query.List<Core.Imprimante>(); > results in the generation of the following SQL statement : > select * from (select rownumber() over() as rownum, this_.CDIMPLOG as CDIMPLOG0_0_, this_.CDSOC as CDSOC0_0_, this_.LBIMP as LBIMP0_0_ FROM TIMPRIM this_) as tempresult where rownum <= ? > This statement is for use with DB2 UDB, but not compatible with DB2 for iSeries. > The statement should use RRN(table) instead of rownumber() and use "fetch first n rows" instead of over(). > DB2400Dialect should override GetLimitString of DB2Dialect to provide with functionality. > Thanks for your support ! -- 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-12-18 15:23:36
|
[ http://jira.nhibernate.org/browse/NH-837?page=comments#action_14625 ] Christophe Vigouroux commented on NH-837: ----------------------------------------- I've just looked to the Hibernate 3.2.1 version of DB2400Dialect and it is implemented like this : public String getLimitString(String sql, int offset, int limit) { return new StringBuffer(sql.length() + 40) .append(sql) .append(" fetch first ") .append(limit) .append(" rows only ") .toString(); } The limit is applied but not the offset. The only way to have something like Row_Number as in DB2 UDB is to create a custom function (UDF) which could have the same behavior, but it should not be used in any public version of NHibernate because it would ask users to install this UDF on their database system. > Error using Limits with DB2400Dialect > ------------------------------------- > > Key: NH-837 > URL: http://jira.nhibernate.org/browse/NH-837 > Project: NHibernate > Type: Bug > Components: Data Providers > Versions: 1.2.0.Beta2 > Reporter: Christophe Vigouroux > > Using with DB2400Dialect : > query.SetFirstResult(startRow); > query.SetMaxResults(maxRows); > IList<Core.Imprimante> retour = query.List<Core.Imprimante>(); > results in the generation of the following SQL statement : > select * from (select rownumber() over() as rownum, this_.CDIMPLOG as CDIMPLOG0_0_, this_.CDSOC as CDSOC0_0_, this_.LBIMP as LBIMP0_0_ FROM TIMPRIM this_) as tempresult where rownum <= ? > This statement is for use with DB2 UDB, but not compatible with DB2 for iSeries. > The statement should use RRN(table) instead of rownumber() and use "fetch first n rows" instead of over(). > DB2400Dialect should override GetLimitString of DB2Dialect to provide with functionality. > Thanks for your support ! -- 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-12-18 15:26:38
|
[ http://jira.nhibernate.org/browse/NH-837?page=comments#action_14626 ] Sergey Koshcheyev commented on NH-837: -------------------------------------- I will implement it like in H3.2.1 then. > Error using Limits with DB2400Dialect > ------------------------------------- > > Key: NH-837 > URL: http://jira.nhibernate.org/browse/NH-837 > Project: NHibernate > Type: Bug > Components: Data Providers > Versions: 1.2.0.Beta2 > Reporter: Christophe Vigouroux > > Using with DB2400Dialect : > query.SetFirstResult(startRow); > query.SetMaxResults(maxRows); > IList<Core.Imprimante> retour = query.List<Core.Imprimante>(); > results in the generation of the following SQL statement : > select * from (select rownumber() over() as rownum, this_.CDIMPLOG as CDIMPLOG0_0_, this_.CDSOC as CDSOC0_0_, this_.LBIMP as LBIMP0_0_ FROM TIMPRIM this_) as tempresult where rownum <= ? > This statement is for use with DB2 UDB, but not compatible with DB2 for iSeries. > The statement should use RRN(table) instead of rownumber() and use "fetch first n rows" instead of over(). > DB2400Dialect should override GetLimitString of DB2Dialect to provide with functionality. > Thanks for your support ! -- 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-12-18 15:28:36
|
[ http://jira.nhibernate.org/browse/NH-837?page=all ] Sergey Koshcheyev updated NH-837: --------------------------------- Fix Version: 1.2.0.Beta3 Priority: Minor (was: Major) > Error using Limits with DB2400Dialect > ------------------------------------- > > Key: NH-837 > URL: http://jira.nhibernate.org/browse/NH-837 > Project: NHibernate > Type: Bug > Components: Data Providers > Versions: 1.2.0.Beta2 > Reporter: Christophe Vigouroux > Priority: Minor > Fix For: 1.2.0.Beta3 > > Using with DB2400Dialect : > query.SetFirstResult(startRow); > query.SetMaxResults(maxRows); > IList<Core.Imprimante> retour = query.List<Core.Imprimante>(); > results in the generation of the following SQL statement : > select * from (select rownumber() over() as rownum, this_.CDIMPLOG as CDIMPLOG0_0_, this_.CDSOC as CDSOC0_0_, this_.LBIMP as LBIMP0_0_ FROM TIMPRIM this_) as tempresult where rownum <= ? > This statement is for use with DB2 UDB, but not compatible with DB2 for iSeries. > The statement should use RRN(table) instead of rownumber() and use "fetch first n rows" instead of over(). > DB2400Dialect should override GetLimitString of DB2Dialect to provide with functionality. > Thanks for your support ! -- 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-02 14:30:22
|
[ http://jira.nhibernate.org/browse/NH-837?page=all ] Sergey Koshcheyev closed NH-837: -------------------------------- Resolution: Fixed > Error using Limits with DB2400Dialect > ------------------------------------- > > Key: NH-837 > URL: http://jira.nhibernate.org/browse/NH-837 > Project: NHibernate > Type: Bug > Components: Data Providers > Versions: 1.2.0.Beta2 > Reporter: Christophe Vigouroux > Priority: Minor > Fix For: 1.2.0.Beta3 > > Using with DB2400Dialect : > query.SetFirstResult(startRow); > query.SetMaxResults(maxRows); > IList<Core.Imprimante> retour = query.List<Core.Imprimante>(); > results in the generation of the following SQL statement : > select * from (select rownumber() over() as rownum, this_.CDIMPLOG as CDIMPLOG0_0_, this_.CDSOC as CDSOC0_0_, this_.LBIMP as LBIMP0_0_ FROM TIMPRIM this_) as tempresult where rownum <= ? > This statement is for use with DB2 UDB, but not compatible with DB2 for iSeries. > The statement should use RRN(table) instead of rownumber() and use "fetch first n rows" instead of over(). > DB2400Dialect should override GetLimitString of DB2Dialect to provide with functionality. > Thanks for your support ! -- 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 |