i'd upgrade to 1.2.0 alpha1 and a CreateSQLQuery that with 1.0.2 works fine, now generate an exception.
i think something change since older version, but what ?
in the log there are some where that i remove from code to simplify the sample; the exception is raised even i remove the where.
Hibernate version: 1.2.0 alpha1
Mapping documents:
<?xml version='1.0' encoding='utf-8'?>
<hibernate-mapping xmlns='urn:nhibernate-mapping-2.0'>
<class name='CUP.Exams,CUP' table='ESAMI'>
<composite-id>
<key-property name='MainCategoryID' column='SPKEY' />
<key-property name='DiagnosticID' column='DIACOD' />
<key-property name='PerformanceTypeID' column='TPRCOD' />
<key-property name='ID' column='ESAARKEY' />
</composite-id>
<many-to-one name="ExamInfo" class="CUP.ExamDescription, CUP"
update="false" insert="false" fetch="join" >
<column name="ESAARKEY" />
</many-to-one>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Code:
string szQuery = "SELECT ESAARKEY {Exams.ID}, SPKEY {Exams.MainCategoryID}, DIACOD {Exams.DiagnosticID}, TPRCOD {Exams.PerformanceTypeID} FROM ESAMI";
IQuery query = this.m_session.CreateSQLQuery(szQuery, "Exams", typeof(Exams));
foreach (Exams exa in query.List()) // EXCEPTION!!!
Full stack trace of any exception that occurs:EXCEPTION : {"could not execute query"}
INNER : {"Impossibile trovare la colonna specificata nel set di risultati"}
in english : {"Impossible to find specified column in the resultset"}
STACK TRACE :
in Oracle.DataAccess.Client.OracleDataReader.GetOrdinal(String name)
in NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name) in c:\net\nhibernate\nhibernate\src\NHibernate\Type\NullableType.cs:riga 247
in NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String[] names, ISessionImplementor session, Object owner) in c:\net\nhibernate\nhibernate\src\NHibernate\Type\NullableType.cs:riga 206
in NHibernate.Type.ManyToOneType.Hydrate(IDataReader rs, String[] names, ISessionImplementor session, Object owner) in c:\net\nhibernate\nhibernate\src\NHibernate\Type\ManyToOneType.cs:riga 75
in NHibernate.Loader.Loader.Hydrate(IDataReader rs, Object id, Object obj, ILoadable persister, ISessionImplementor session, String[][] suffixedPropertyColumns) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 1028
in NHibernate.Loader.Loader.LoadFromResultSet(IDataReader rs, Int32 i, Object obj, Type instanceClass, EntityKey key, LockMode lockMode, ILoadable rootPersister, ISessionImplementor session) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 927
in NHibernate.Loader.Loader.InstanceNotYetLoaded(IDataReader dr, Int32 i, ILoadable persister, EntityKey key, LockMode lockMode, EntityKey optionalObjectKey, Object optionalObject, IList hydratedObjects, ISessionImplementor session) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 884
in NHibernate.Loader.Loader.GetRow(IDataReader rs, ILoadable[] persisters, EntityKey[] keys, Object optionalObject, EntityKey optionalObjectKey, LockMode[] lockModes, IList hydratedObjects, ISessionImplementor session) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 818
in NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 294
in NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 425
in NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 182
in NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 1636
Name and version of the database you are using:Oracle 10g
The generated SQL (show_sql=true):{SELECT ESAARKEY ESAARKEY0_, SPKEY SPKEY0_, DIACOD DIACOD0_, TPRCOD TPRCOD0_ FROM ESAMI}
Debug level Hibernate log excerpt:2006-07-26 11:49:46,693 [3688] DEBUG NHibernate.Impl.BatcherImpl - Opened new IDbCommand, open IDbCommands :1
2006-07-26 11:49:46,693 [3688] DEBUG NHibernate.Impl.BatcherImpl - Building an IDbCommand object for the SqlString: SELECT ESAARKEY ESAARKEY0_, SPKEY SPKEY0_, DIACOD DIACOD0_, TPRCOD TPRCOD0_ FROM ESAMI WHERE ESAMI.SPKEY = 'RADIOL' AND ESAMI.DIACOD <> '*' AND ESAMI.TPRCOD <> '*' AND ESAMI.ESAARKEY <> '*' ORDER BY ESAMI.SPKEY ASC,ESAMI.DIACOD ASC, ESAMI.TPRCOD ASC, ESAMI.ESAARKEY ASC
2006-07-26 11:49:46,693 [3688] INFO NHibernate.Loader.Loader - SELECT ESAARKEY ESAARKEY0_, SPKEY SPKEY0_, DIACOD DIACOD0_, TPRCOD TPRCOD0_ FROM ESAMI WHERE ESAMI.SPKEY = 'RADIOL' AND ESAMI.DIACOD <> '*' AND ESAMI.TPRCOD <> '*' AND ESAMI.ESAARKEY <> '*' ORDER BY ESAMI.SPKEY ASC,ESAMI.DIACOD ASC, ESAMI.TPRCOD ASC, ESAMI.ESAARKEY ASC
2006-07-26 11:49:46,693 [3688] DEBUG NHibernate.SQL - SELECT ESAARKEY ESAARKEY0_, SPKEY SPKEY0_, DIACOD DIACOD0_, TPRCOD TPRCOD0_ FROM ESAMI WHERE ESAMI.SPKEY = 'RADIOL' AND ESAMI.DIACOD <> '*' AND ESAMI.TPRCOD <> '*' AND ESAMI.ESAARKEY <> '*' ORDER BY ESAMI.SPKEY ASC,ESAMI.DIACOD ASC, ESAMI.TPRCOD ASC, ESAMI.ESAARKEY ASC
2006-07-26 11:49:46,708 [3688] DEBUG NHibernate.Impl.BatcherImpl - Opened Reader, open Readers :1
2006-07-26 11:49:46,708 [3688] DEBUG NHibernate.Loader.Loader - processing result set
2006-07-26 11:49:46,708 [3688] DEBUG NHibernate.Loader.Loader - result set row: 0
2006-07-26 11:49:46,708 [3688] DEBUG NHibernate.Type.StringType - returning 'RADIOL' as column: SPKEY0_
2006-07-26 11:49:46,708 [3688] DEBUG NHibernate.Type.StringType - returning 'SALA1 ' as column: DIACOD0_
2006-07-26 11:49:46,724 [3688] DEBUG NHibernate.Type.StringType - returning 'ECHECA' as column: TPRCOD0_
2006-07-26 11:49:46,724 [3688] DEBUG NHibernate.Type.StringType - returning 'ZZO ' as column: ESAARKEY0_
2006-07-26 11:49:46,724 [3688] DEBUG NHibernate.Loader.Loader - result row: CUP.Exams
2006-07-26 11:49:46,724 [3688] DEBUG NHibernate.Loader.Loader - Initializing object from DataReader: [CUP.Exams#CUP.Exams]
2006-07-26 11:49:46,724 [3688] DEBUG NHibernate.Loader.Loader - Hydrating entity: CUP.Exams#CUP.Exams
2006-07-26 11:49:46,990 [3688] DEBUG NHibernate.Impl.BatcherImpl - Closed Reader, open Readers :0
2006-07-26 11:49:46,990 [3688] DEBUG NHibernate.Impl.BatcherImpl - Closed IDbCommand, open IDbCommands :0
2006-07-26 11:49:46,990 [3688] DEBUG NHibernate.Util.ADOExceptionReporter - could not execute query [SELECT ESAARKEY ESAARKEY0_, SPKEY SPKEY0_, DIACOD DIACOD0_, TPRCOD TPRCOD0_ FROM ESAMI WHERE ESAMI.SPKEY = 'RADIOL' AND ESAMI.DIACOD <> '*' AND ESAMI.TPRCOD <> '*' AND ESAMI.ESAARKEY <> '*' ORDER BY ESAMI.SPKEY ASC,ESAMI.DIACOD ASC, ESAMI.TPRCOD ASC, ESAMI.ESAARKEY ASC]
System.IndexOutOfRangeException: Impossibile trovare la colonna specificata nel set di risultati
in Oracle.DataAccess.Client.OracleDataReader.GetOrdinal(String name)
in NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name) in c:\net\nhibernate\nhibernate\src\NHibernate\Type\NullableType.cs:riga 247
in NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String[] names, ISessionImplementor session, Object owner) in c:\net\nhibernate\nhibernate\src\NHibernate\Type\NullableType.cs:riga 206
in NHibernate.Type.ManyToOneType.Hydrate(IDataReader rs, String[] names, ISessionImplementor session, Object owner) in c:\net\nhibernate\nhibernate\src\NHibernate\Type\ManyToOneType.cs:riga 75
in NHibernate.Loader.Loader.Hydrate(IDataReader rs, Object id, Object obj, ILoadable persister, ISessionImplementor session, String[][] suffixedPropertyColumns) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 1028
in NHibernate.Loader.Loader.LoadFromResultSet(IDataReader rs, Int32 i, Object obj, Type instanceClass, EntityKey key, LockMode lockMode, ILoadable rootPersister, ISessionImplementor session) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 927
in NHibernate.Loader.Loader.InstanceNotYetLoaded(IDataReader dr, Int32 i, ILoadable persister, EntityKey key, LockMode lockMode, EntityKey optionalObjectKey, Object optionalObject, IList hydratedObjects, ISessionImplementor session) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 884
in NHibernate.Loader.Loader.GetRow(IDataReader rs, ILoadable[] persisters, EntityKey[] keys, Object optionalObject, EntityKey optionalObjectKey, LockMode[] lockModes, IList hydratedObjects, ISessionImplementor session) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 818
in NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 294
in NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 425
in NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 182
in NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 1636
2006-07-26 11:49:47,005 [3688] WARN NHibernate.Util.ADOExceptionReporter - System.IndexOutOfRangeException: Impossibile trovare la colonna specificata nel set di risultati
in Oracle.DataAccess.Client.OracleDataReader.GetOrdinal(String name)
in NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name) in c:\net\nhibernate\nhibernate\src\NHibernate\Type\NullableType.cs:riga 247
in NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String[] names, ISessionImplementor session, Object owner) in c:\net\nhibernate\nhibernate\src\NHibernate\Type\NullableType.cs:riga 206
in NHibernate.Type.ManyToOneType.Hydrate(IDataReader rs, String[] names, ISessionImplementor session, Object owner) in c:\net\nhibernate\nhibernate\src\NHibernate\Type\ManyToOneType.cs:riga 75
in NHibernate.Loader.Loader.Hydrate(IDataReader rs, Object id, Object obj, ILoadable persister, ISessionImplementor session, String[][] suffixedPropertyColumns) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 1028
in NHibernate.Loader.Loader.LoadFromResultSet(IDataReader rs, Int32 i, Object obj, Type instanceClass, EntityKey key, LockMode lockMode, ILoadable rootPersister, ISessionImplementor session) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 927
in NHibernate.Loader.Loader.InstanceNotYetLoaded(IDataReader dr, Int32 i, ILoadable persister, EntityKey key, LockMode lockMode, EntityKey optionalObjectKey, Object optionalObject, IList hydratedObjects, ISessionImplementor session) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 884
in NHibernate.Loader.Loader.GetRow(IDataReader rs, ILoadable[] persisters, EntityKey[] keys, Object optionalObject, EntityKey optionalObjectKey, LockMode[] lockModes, IList hydratedObjects, ISessionImplementor session) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 818
in NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 294
in NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 425
in NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 182
in NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:riga 1636
2006-07-26 11:49:47,021 [3688] ERROR NHibernate.Util.ADOExceptionReporter - Impossibile trovare la colonna specificata nel set di risultati[/code]