For some reason NHibernate is generating SQL and instead of using @param1, @param2 it is using ?'s (see below). We originally thought it must be a problem with the dialect but have confirmed that we are using MsSqlServer2000Dialect...
We also verified that the variables are not null, and even tried using constants instead -same result.
We also tried several other dialects (even Oracle 9) and it still generated the same SQL.
Any help or insight would be greatly appreciated.
NHibernate 1.2.1
SQL Server 2000
Generated SQL Snippet:
Code:
WHERE (this_.ActionName = ? and this_.SinkName = ?) <-- Why is it ?'s instead of @param?
Code:Code:
ISession session = NHibernateHelper.DefaultSessionFactory.GetSession();
IList<IControllerAction> actions = session.CreateCriteria(typeof(IControllerAction))
.Add(Expression.And(Expression.Eq("Name", name), Expression.Eq("Sink", sink)))
.List<IControllerAction>();
Complete generated SQL:Code:
SELECT this_.ActionId as ActionId6_2_,
this_.Updated as Updated6_2_,
this_.ActionName as ActionName6_2_,
this_.SinkName as SinkName6_2_,
this_.Layout as Layout6_2_,
this_.ExternalUrl as External6_6_2_,
this_.IsAuthRequired as IsAuthRe7_6_2_,
this_.IsEnabled as IsEnabled6_2_,
this_.Expires as Expires6_2_,
this_.Created as Created6_2_,
this_.CreatedBy as CreatedBy6_2_,
this_.LastModified as LastMod12_6_2_,
this_.LastModifiedBy as LastMod13_6_2_,
'C' as clazz_2_,
usermeta2_.UserId as UserId0_0_,
usermeta2_.UserName as UserName0_0_,
usermeta2_1_.Email as Email1_0_,
usermeta3_.UserId as UserId0_1_,
usermeta3_.UserName as UserName0_1_,
usermeta3_1_.Email as Email1_1_
FROM Actions this_
left outer join aspnet_Users usermeta2_
on this_.CreatedBy = usermeta2_.UserId
left outer join aspnet_Membership usermeta2_1_
on usermeta2_.UserId = usermeta2_1_.UserId
left outer join aspnet_Users usermeta3_
on this_.LastModifiedBy = usermeta3_.UserId
left outer join aspnet_Membership usermeta3_1_
on usermeta3_.UserId = usermeta3_1_.UserId
WHERE (this_.ActionName = ? and this_.SinkName = ?)