Hi
Does CreateSQLQuery work in version 0.8.4? Or do I have to get a version from cvs?
I have the following code on 0.8.4 (not form cvs)
Code:
string sql = "SELECT {t2.Id}, {t2.PageName}, {t2.Allow} FROM (Roles {t1} " +
"INNER JOIN Pages {t2} ON t2.RoleId = t1.RoleId) " +
"INNER JOIN Users {t3} ON t3.RoleId = t1.RoleId " +
"WHERE {t3}.UserId = :UserId";
IQuery q = this._activeSession.CreateSQLQuery(sql, new string[] { "t2", "t3", "t1" },
new System.Type[] { typeof( PagesEntity ), typeof( UsersEntity ), typeof( RolesEntity ) });
q.SetInt32("UserId", 11);
IList results = q.List();
When it gets executed, I get the following exception in NHibernate\Type\NullableType.cs Line: 210:
Quote:
IndexOutOfRangeException: PageId0_
System.Data.Common.FieldNameLookup.GetOrdinal(String fieldName)
System.Data.OleDb.OleDbDataReader.GetOrdinal(String name)
NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name) in D:\Support\SupportWebSite\SupportWebSite\src\NHibernate\Type\NullableType.cs:210
NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String[] names, ISessionImplementor session, Object owner) in D:\Support\SupportWebSite\SupportWebSite\src\NHibernate\Type\NullableType.cs:169
NHibernate.Loader.Loader.GetKeyFromResultSet(Int32 i, ILoadable persister, Object id, IDataReader rs, ISessionImplementor session) in D:\Support\SupportWebSite\SupportWebSite\src\NHibernate\Loader\Loader.cs:505
NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, IList hydratedObjects, Object optionalObject, Object optionalId, Key[] keys, Boolean returnProxies) in D:\Support\SupportWebSite\SupportWebSite\src\NHibernate\Loader\Loader.cs:242
NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies) in D:\Support\SupportWebSite\SupportWebSite\src\NHibernate\Loader\Loader.cs:328
NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies) in D:\Support\SupportWebSite\SupportWebSite\src\NHibernate\Loader\Loader.cs:180
NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) in D:\Support\SupportWebSite\SupportWebSite\src\NHibernate\Loader\Loader.cs:155
NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes) in D:\Support\SupportWebSite\SupportWebSite\src\NHibernate\Loader\Loader.cs:1115
NHibernate.Loader.SqlLoader.List(ISessionImplementor session, QueryParameters queryParameters) in D:\Support\SupportWebSite\SupportWebSite\src\NHibernate\Loader\SqlLoader.cs:225
NHibernate.Impl.SessionImpl.FindBySQL(String sqlQuery, String[] aliases, Type[] classes, QueryParameters queryParameters, ICollection querySpaces) in D:\Support\SupportWebSite\SupportWebSite\src\NHibernate\Impl\SessionImpl.cs:5248
NHibernate.Impl.SqlQueryImpl.List() in D:\Support\SupportWebSite\SupportWebSite\src\NHibernate\Impl\SqlQueryImpl.cs:80
Si.Support.Data.HibernateUtils.GetUserByUsernameAndPassword(String username, String password) in d:\support\supportwebsite\supportwebsite\src\server\si.support.data\hibernateutils.cs:289
SupportWebSite.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\supportwebsite\default.aspx.cs:60
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
Lp
Sebastijan