From: Andrei A. (JIRA) <nh...@gm...> - 2011-05-12 18:17:53
|
SqlFunctionProjection does not honor parameter order ---------------------------------------------------- Key: NH-2700 URL: http://216.121.112.228/browse/NH-2700 Project: NHibernate Issue Type: Bug Components: Core Affects Versions: 3.2.0Alpha3, 3.2.0Alpha2, 3.2.0Alpha1, 3.1.0, 3.0.0.GA, 3.0.0.CR1, 3.0.0.Beta2, 3.0.0.Beta1, 3.0.0.Alpha3, 3.0.0.Alpha2, 3.0.0.Alpha1 Reporter: Andrei Alecu Priority: Minor If you define a function in a custom dialect that does not have the parameters in order and use SqlFunctionProjection, the generated sql is wrong, and does not honor parameter order. For example: RegisterFunction( "AddDays", new SQLFunctionTemplate( NHibernateUtil.DateTime, "dateadd(day,?2,?1)" ) ); var proj = new SqlFunctionProjection("AddDays", NHibernateUtil.DateTime, new IProjection[] { Projections.Property<ModelClass>(p=>p.Date1), Projections.Property<ModelClass>(p=>p.Value1) }); Generated SQL (buggy): SELECT dateadd(day,this_.Date1,this_.Value1) Expected SQL: SELECT dateadd(day,this_.Value1,this_.Date1) Using an HQL query honors parameter order properly I will attach a failing unit test. -- 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 |