Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NH-686 - Formula field in joined subclass possibly works incorrectly #776

Open
nhibernate-bot opened this issue Oct 12, 2017 · 0 comments
Open

Comments

@nhibernate-bot
Copy link
Collaborator

nhibernate-bot commented Oct 12, 2017

airx created an issue — 4th August 2006, 22:29:23:

I have created the following mapping:

<?xml version="1.0" encoding="utf-8" ?> 
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
    <class name="CoreIMSEE.Domain.Partner, CoreIMSEE.Domain" table="PARTNER">
		<id name="Id" column="ID" unsaved-value="0" access="field.camelcase">
			<generator class="native" />
		</id>
		
		<timestamp name="timestamp" column="TS" access="field"/>

    <property name="Code" column="CODE" type="String" length="50" not-null="true" />
		<property name="Name" column="NAME" type="String" length="100" not-null="true" />
		<property name="IsVendor" column="IS_VENDOR" type="YesNo" not-null="true" />
		<property name="IsCustomer" column="IS_CUSTOMER" type="YesNo" not-null="true" />
		<property name="IsClient" column="IS_CLIENT" type="YesNo" not-null="true" />
		<property name="IsActive" column="IS_ACTIVE" type="YesNo" not-null="true" />
      <property name="IsAutoFax" column="AUTOFAX" type="YesNo" not-null="true" />
		<many-to-one name="Address" column="ADDRESS_ID" not-null="true" cascade="all" />
    <many-to-one name="CreatedBy" column="CREATED_BY" not-null="false" cascade="none" />
    <many-to-one name="VerifiedBy" column="VERIFIED_BY" not-null="false" cascade="none" />

      <joined-subclass name="CoreIMSEE.Domain.Customer, CoreIMSEE.Domain" table="CUSTOMER">
			<key column="ID" />
		
			<!--timestamp name="timestamp" column="TS" access="field"/-->
			
			<property name="IsDefault" column="IS_DEFAULT" type="YesNo" not-null="true" />
			<property name="IsVerified" column="IS_VERIFIED" type="YesNo" not-null="true" />
			<property name="Name2" column="NAME2" />
			<property name="Name3" column="NAME3" />
      <property name="customerName" formula="(select p.Name from Partner p where p.Id = Id) + ' ' + Name2 + ' ' + Name3" insert="false" update="false" type="String" access="field" />

      <property name="TaxId" column="TAX_ID" type="String" length="1" not-null="true" />
			<property name="IsTaxExempt" column="TAX_EXEMPT" type="YesNo" not-null="true" />
			<property name="TxStatementType" column="TX_STATEMENT_TYPE" type="String" length="50" not-null="true" />
			<property name="TxStatementFrequency" column="TX_STATEMENT_FREQ" type="String" length="50" not-null="true" />
			<property name="StorageStatementType" column="STORAGE_STATEMENT_TYPE" type="String" length="50" not-null="true" />
			<property name="StorageStatementFrequency" column="STORAGE_STATEMENT_FREQ" type="String" length="50" not-null="true" />
			<many-to-one name="BillingAddress" column="BILLING_ADDRESS_ID" cascade="all"/>
			<many-to-one name="ParentCustomer" column="PARENT_ID" />
      <set name="CustomerCrossReference" cascade ="all">
        <key column="CUSTOMER_ID"/>
        <one-to-many class="CoreIMSEE.Domain.CustomerCrossReference, CoreIMSEE.Domain"/>
      </set>
			
		</joined-subclass>

      <!--joined-subclass name="CoreIMSEE.Domain.Vendor, CoreIMSEE.Domain" table="VENDOR">
        <key column="ID" />
        
      </joined-subclass-->
				
	</class>
</hibernate-mapping>

I want to use property Name from Partner in formula field in Customer. But this works incorrectly (Excaption occurs) because in generated SQL field Name translates into [customer_alias].Name instead of [partner_alias.Name]. I solved this using (select p.Namr from Partner where p.Id = Id)

      <property name="customerName" formula="(select p.Name from Partner p where p.Id = Id) + ' ' + Name2 + ' ' + Name3" insert="false" update="false" type="String" access="field" />

, but this is nor very effective solution because we can just use Partner table which is Joined in generated SQL.

SQL:

SELECT customer0_.ID as ID6_, customer0_.IS_VERIFIED as IS_VER3_4_6_, customer0_.BILLING_ADDRESS_ID as BILLI12_4_6_, customer0_.NAME2 as NAME24_6_, customer0_.NAME3 as NAME34_6_, customer0_.TX_STATEMENT_FREQ as TX_STA9_4_6_, customer0_.STORAGE_STATEMENT_TYPE as STORA10_4_6_, customer0_.PARENT_ID as PAREN13_4_6_, customer0_.IS_DEFAULT as IS_DEF2_4_6_, customer0_.TAX_EXEMPT as TAX_EX7_4_6_, customer0_.TX_STATEMENT_TYPE as TX_STA8_4_6_, customer0_.STORAGE_STATEMENT_FREQ as STORA11_4_6_, customer0_.TAX_ID as TAX_ID4_6_, <customer0__1_>.IS_ACTIVE as IS_ACT8_3_6_, [customer0__1_].NAME as NAME3_6_, [customer0__1_].ADDRESS_ID as ADDRE10_3_6_, [customer0__1_].IS_CUSTOMER as IS_CUS6_3_6_, [customer0__1_].VERIFIED_BY as VERIF12_3_6_, [customer0__1_].CREATED_BY as CREAT11_3_6_, [customer0__1_].TS as TS3_6_, [customer0__1_].IS_VENDOR as IS_VEN5_3_6_, [customer0__1_].IS_CLIENT as IS_CLI7_3_6_, [customer0__1_].CODE as CODE3_6_, [customer0__1_].AUTOFAX as AUTOFAX3_6_, customer0_.Name + ' ' + customer0_.Name2 + ' ' + customer0_.Name3 as f1_6_, address1_.ID as ID0_, address1_.STATE_CODE as STATE_CODE0_, address1_.FAX1 as FAX10_, address1_.STREET2 as STREET20_, address1_.TS as TS0_, address1_.COUNTRY_CODE as COUNTRY18_0_, address1_.FAX2 as FAX20_, address1_.EMAIL1 as EMAIL10_, address1_.CITY as CITY0_, address1_.PHONE2 as PHONE20_, address1_.SWIFT_BIC_CODE as SWIFT_BI8_0_, address1_.ZIP as ZIP0_, address1_.CONTACT1 as CONTACT10_, address1_.PHONE1 as PHONE10_, address1_.STREET3 as STREET30_, address1_.STREET1 as STREET10_, address1_.EMAIL2 as EMAIL20_, address1_.CONTACT2 as CONTACT20_, address1_.PHONE3 as PHONE30_, state2_.CODE as CODE1_, state2_.DESCRIPTION as DESCRIPT2_1_, state2_.COUNTRY_CODE as COUNTRY_3_1_, country3_.CODE as CODE2_, country3_.DESCRIPTION as DESCRIPT2_2_, country4_.CODE as CODE3_, country4_.DESCRIPTION as DESCRIPT2_3_, user5_.ID as ID4_, user5_.EMAIL as EMAIL4_, user5_.PASSWORD_EXPIRES as PASSWORD5_4_, user5_.PHONE as PHONE4_, user5_.FIRST_NAME as FIRST_NAME4_, user5_.TS as TS4_, user5_.ROWS_PER_PAGE as ROWS_PE10_4_, user5_.PASSWORD as PASSWORD4_, user5_.PREF_CULTURE_NAME as PREF_CU11_4_, user5_.USERNAME as USERNAME4_, user5_.LAST_NAME as LAST_NAME4_, user6_.ID as ID5_, user6_.EMAIL as EMAIL5_, user6_.PASSWORD_EXPIRES as PASSWORD5_5_, user6_.PHONE as PHONE5_, user6_.FIRST_NAME as FIRST_NAME5_, user6_.TS as TS5_, user6_.ROWS_PER_PAGE as ROWS_PE10_5_, user6_.PASSWORD as PASSWORD5_, user6_.PREF_CULTURE_NAME as PREF_CU11_5_, user6_.USERNAME as USERNAME5_, user6_.LAST_NAME as LAST_NAME5_ FROM CUSTOMER customer0_ inner join PARTNER [customer0__1_] on customer0_.ID=[customer0__1_].ID left outer join ADDRESS address1_ on customer0_.BILLING_ADDRESS_ID=address1_.ID left outer join STATE state2_ on address1_.STATE_CODE=state2_.CODE left outer join COUNTRY country3_ on state2_.COUNTRY_CODE=country3_.CODE left outer join COUNTRY country4_ on address1_.COUNTRY_CODE=country4_.CODE left outer join SYS_USER user5_ on [customer0__1_].VERIFIED_BY=user5_.ID left outer join SYS_USER user6_ on [customer0__1_].CREATED_BY=user6_.ID WHERE customer0_.ID=:ID
Exception details:
System.Data.SqlClient.SqlException: Invalid column name 'Name'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
   at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
2006-08-05 09:27:00,310 <4940> WARN  NHibernate.Util.ADOExceptionReporter [(null)] - System.Data.SqlClient.SqlException: Invalid column name 'Name'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
   at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
2006-08-05 09:27:00,310 <4940> ERROR NHibernate.Util.ADOExceptionReporter [(null)] - Invalid column name 'Name'.
2006-08-05 09:27:00,310 <4940> DEBUG NHibernate.Impl.BatcherImpl [(null)] - Closed IDbCommand, open IDbCommands :0
2006-08-05 09:27:00,310 <4940> DEBUG NHibernate.Util.ADOExceptionReporter [(null)] - could not load by id: <CoreIMSEE.Domain.Customer#1>
System.Data.SqlClient.SqlException: Invalid column name 'Name'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
   at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
   at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
   at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
   at NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object<] values, IType[> types, Object optionalObject, Object optionalID)
   at NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object id, IType identifierType, Object optionalObject, Object optionalIdentifier)
   at NHibernate.Loader.EntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject, Object optionalId)
   at NHibernate.Loader.EntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject)
   at NHibernate.Persister.NormalizedEntityPersister.Load(Object id, Object optionalObject, LockMode lockMode, ISessionImplementor session)
2006-08-05 09:27:00,326 <4940> WARN  NHibernate.Util.ADOExceptionReporter [(null)] - System.Data.SqlClient.SqlException: Invalid column name 'Name'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
   at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
   at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
   at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
   at NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object<] values, IType[> types, Object optionalObject, Object optionalID)
   at NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object id, IType identifierType, Object optionalObject, Object optionalIdentifier)
   at NHibernate.Loader.EntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject, Object optionalId)
   at NHibernate.Loader.EntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject)
   at NHibernate.Persister.NormalizedEntityPersister.Load(Object id, Object optionalObject, LockMode lockMode, ISessionImplementor session)
2006-08-05 09:27:00,326 <4940> ERROR NHibernate.Util.ADOExceptionReporter [(null)] - Invalid column name 'Name'.
2006-08-05 09:27:00,326 <4940> ERROR CoreIMSEE.Core.Persistence.HqlExecutor [(null)] - Could not execute query
NHibernate.ADOException: Could not execute query ---> NHibernate.ADOException: could not load by id: <CoreIMSEE.Domain.Customer#1> ---> System.Data.SqlClient.SqlException: Invalid column name 'Name'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
   at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
   at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
   at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
   at NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object<] values, IType[> types, Object optionalObject, Object optionalID)
   at NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object id, IType identifierType, Object optionalObject, Object optionalIdentifier)
   at NHibernate.Loader.EntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject, Object optionalId)
   at NHibernate.Loader.EntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject)
   at NHibernate.Persister.NormalizedEntityPersister.Load(Object id, Object optionalObject, LockMode lockMode, ISessionImplementor session)
   --- End of inner exception stack trace ---
   at NHibernate.Persister.NormalizedEntityPersister.Load(Object id, Object optionalObject, LockMode lockMode, ISessionImplementor session)
   at NHibernate.Impl.SessionImpl.DoLoad(Type theClass, Object id, Object optionalObject, LockMode lockMode, Boolean checkDeleted)
   at NHibernate.Impl.SessionImpl.DoLoadByClass(Type clazz, Object id, Boolean checkDeleted, Boolean allowProxyCreation)
   at NHibernate.Impl.SessionImpl.InternalLoad(Type clazz, Object id)
   at NHibernate.Type.ManyToOneType.ResolveIdentifier(Object id, ISessionImplementor session)
   at NHibernate.Type.EntityType.ResolveIdentifier(Object id, ISessionImplementor session, Object owner)
   at NHibernate.Impl.SessionImpl.InitializeEntity(Object obj)
   at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList hydratedObjects, Object resultSetId, ISessionImplementor session)
   at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
   at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
   at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
   at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes)
   at NHibernate.Hql.QueryTranslator.List(ISessionImplementor session, QueryParameters queryParameters)
   at NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters)
   --- End of inner exception stack trace ---
   at NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters)
   at NHibernate.Impl.QueryImpl.List()
   at CoreIMSEE.Core.Persistence.HqlExecutor.Execute(IHqlQueryFilterState filterState) in C:\Inetpub\wwwroot\CoreIMSEE.HSBC\CoreIMSEE.Core\Core\Persistence\HqlExecutor.cs:line 135
   at CoreIMSEE.Core.Persistence.HqlExecutor.Execute(IFilterState filterState) in C:\Inetpub\wwwroot\CoreIMSEE.HSBC\CoreIMSEE.Core\Core\Persistence\HqlExecutor.cs:line 73
2006-08-05 09:27:00,326 <4940> WARN  CoreIMSEE.Core.Persistence.PstInterceptor [(null)] - exception is thrown, rolling back a transaction and closing current session
NHibernate.ADOException: Could not execute query ---> NHibernate.ADOException: could not load by id: <CoreIMSEE.Domain.Customer#1> ---> System.Data.SqlClient.SqlException: Invalid column name 'Name'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
   at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
   at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
   at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
   at NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object<] values, IType[> types, Object optionalObject, Object optionalID)
   at NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object id, IType identifierType, Object optionalObject, Object optionalIdentifier)
   at NHibernate.Loader.EntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject, Object optionalId)
   at NHibernate.Loader.EntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject)
   at NHibernate.Persister.NormalizedEntityPersister.Load(Object id, Object optionalObject, LockMode lockMode, ISessionImplementor session)
   --- End of inner exception stack trace ---
   at NHibernate.Persister.NormalizedEntityPersister.Load(Object id, Object optionalObject, LockMode lockMode, ISessionImplementor session)
   at NHibernate.Impl.SessionImpl.DoLoad(Type theClass, Object id, Object optionalObject, LockMode lockMode, Boolean checkDeleted)
   at NHibernate.Impl.SessionImpl.DoLoadByClass(Type clazz, Object id, Boolean checkDeleted, Boolean allowProxyCreation)
   at NHibernate.Impl.SessionImpl.InternalLoad(Type clazz, Object id)
   at NHibernate.Type.ManyToOneType.ResolveIdentifier(Object id, ISessionImplementor session)
   at NHibernate.Type.EntityType.ResolveIdentifier(Object id, ISessionImplementor session, Object owner)
   at NHibernate.Impl.SessionImpl.InitializeEntity(Object obj)
   at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList hydratedObjects, Object resultSetId, ISessionImplementor session)
   at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
   at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
   at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
   at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes)
   at NHibernate.Hql.QueryTranslator.List(ISessionImplementor session, QueryParameters queryParameters)
   at NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters)
   --- End of inner exception stack trace ---
   at Spring.Aop.Framework.AbstractMethodInvocation.InvokeJoinpoint() in C:\dotnet\2005 patched frameworks\Spring.NET 1.1 Preview 2\src\Spring\Spring.Aop\Aop\Framework\AbstractMethodInvocation.cs:line 275
   at Spring.Aop.Framework.AbstractMethodInvocation.Proceed() in C:\dotnet\2005 patched frameworks\Spring.NET 1.1 Preview 2\src\Spring\Spring.Aop\Aop\Framework\AbstractMethodInvocation.cs:line 224
   at CoreIMSEE.Core.Persistence.PstInterceptor.Invoke(IMethodInvocation invocation) in C:\Inetpub\wwwroot\CoreIMSEE.HSBC\CoreIMSEE.Core\Core\Persistence\PstInterceptor.cs:line 80

airx added a comment — 4th August 2006, 22:32:06:

formula in mapping incorrect - correct value is : formula = "Name + ' ' + Name2 + ' ' + Name3"


justme84 added a comment — 6th November 2006, 3:12:00:

Marking this as improvement since it works as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants