NHibernate.Exceptions.GenericADOException: 'could not execute query

I’m using NHibernate version : 4.1.0.4000
Oracle Client version 19c (x64)
ODP.NET – Oracle.DataAccess.dll : 2.122.19.1
.Net – 4.6.1 (x64)

There are lots of columns in Tickets with different kind of foreign keys
Below is the Error Message:
could not execute query
[ select ticket0_.TICK_ID as TICK1_154_, ticket0_.TICK_NUMBER as TICK2_154_, ticket0_.TICK_IMEI as TICK3_154_, ticket0_.TICK_CELL_WIFI_MAC as TICK4_154_, ticket0_.TICK_CELL_BLUETOOTH_MAC as TICK5_154_, ticket0_.TICK_DATE as TICK6_154_, ticket0_.TICK_UTC_DATE as TICK7_154_, ticket0_.TICK_LPR_PLATE as TICK8_154_, ticket0_.TICK_QUERY_PLATE as TICK9_154_, ticket0_.TICK_QUERY_EQ_LPR_PLATE as TIC10_154_, ticket0_.TICK_STR_NUMBER as TIC11_154_, ticket0_.TICK_LATITUDE as TIC12_154_, ticket0_.TICK_LONGITUDE as TIC13_154_, ticket0_.TICK_IMAGE_URL as TIC14_154_, ticket0_.TICK_PAY_AMOUNT as TIC15_154_, ticket0_.TICK_STATUS_DATE as TIC16_154_, ticket0_.TICK_STATUS_DATE_UTC as TIC17_154_, ticket0_.TICK_PAY_EXTPRO_OP_ID as TIC18_154_, ticket0_.TICK_PAY_EXTPRO_PAY_ENTITY as TIC19_154_, ticket0_.TICK_MAXPAYDATE as TIC20_154_, ticket0_.TICK_PARKING_INIDATE as TIC21_154_, ticket0_.TICK_PARKING_ENDDATE as TIC22_154_, ticket0_.TICK_PARKING_TIME as TIC23_154_, ticket0_.TICK_SELECTED_PLATE as TIC24_154_, ticket0_.TICK_FINE_NUMBER as TIC25_154_, ticket0_.TICK_STR_NUMBER_FROM as TIC26_154_, ticket0_.TICK_STR_NUMBER_TO as TIC27_154_, ticket0_.TICK_AMOUNT as TIC28_154_, ticket0_.TICK_SYNC_MANAGED as TIC29_154_, ticket0_.TICK_BALANCE as TIC30_154_, ticket0_.TICK_INITIAL_AMOUNT as TIC31_154_, ticket0_.TICK_AGING2_DATE as TIC32_154_, ticket0_.TICK_AGING2_UTCDATE as TIC33_154_, ticket0_.TICK_AGING2_AMOUNT as TIC34_154_, ticket0_.TICK_AGING3_DATE as TIC35_154_, ticket0_.TICK_AGING3_UTCDATE as TIC36_154_, ticket0_.TICK_AGING3_AMOUNT as TIC37_154_, ticket0_.TICK_AGING4_DATE as TIC38_154_, ticket0_.TICK_AGING4_UTCDATE as TIC39_154_, ticket0_.TICK_AGING4_AMOUNT as TIC40_154_, ticket0_.TICK_AGING5_DATE as TIC41_154_, ticket0_.TICK_AGING5_UTCDATE as TIC42_154_, ticket0_.TICK_AGING5_AMOUNT as TIC43_154_, ticket0_.TICK_PUBLIC_NOTES as TIC44_154_, ticket0_.TICK_PRIVATE_NOTES as TIC45_154_, ticket0_.TICK_ID_TYPE as TIC46_154_, ticket0_.TICK_TRANSIT_DOCUMENTISSUEDATE as TIC47_154_, ticket0_.TICK_TRANSIT_DOCUMENTEXPDATE as TIC48_154_, ticket0_.TICK_IS_WARNING as TIC49_154_, ticket0_.TICK_IS_SENTBYPOSTALMAIL as TIC50_154_, ticket0_.TICK_FEE_INITIAL_AMOUNT as TIC51_154_, ticket0_.TICK_FEE_AGING2_AMOUNT as TIC52_154_, ticket0_.TICK_FEE_AGING3_AMOUNT as TIC53_154_, ticket0_.TICK_FEE_AGING4_AMOUNT as TIC54_154_, ticket0_.TICK_FEE_AGING5_AMOUNT as TIC55_154_, ticket0_.TICK_TOWING_INITIAL_AMOUNT as TIC56_154_, ticket0_.TICK_TOWING_AGING2_AMOUNT as TIC57_154_, ticket0_.TICK_TOWING_AGING3_AMOUNT as TIC58_154_, ticket0_.TICK_TOWING_AGING4_AMOUNT as TIC59_154_, ticket0_.TICK_TOWING_AGING5_AMOUNT as TIC60_154_, ticket0_.TICK_FEE2_INITIAL_AMOUNT as TIC61_154_, ticket0_.TICK_FEE2_AGING2_AMOUNT as TIC62_154_, ticket0_.TICK_FEE2_AGING3_AMOUNT as TIC63_154_, ticket0_.TICK_FEE2_AGING4_AMOUNT as TIC64_154_, ticket0_.TICK_FEE2_AGING5_AMOUNT as TIC65_154_, ticket0_.TICK_TOTAL_INITIAL_AMOUNT as TIC66_154_, ticket0_.TICK_TOTAL_AGING2_AMOUNT as TIC67_154_, ticket0_.TICK_TOTAL_AGING3_AMOUNT as TIC68_154_, ticket0_.TICK_TOTAL_AGING4_AMOUNT as TIC69_154_, ticket0_.TICK_TOTAL_AGING5_AMOUNT as TIC70_154_, ticket0_.TICK_VIN as TIC71_154_, ticket0_.TICK_TRANSIT_DOC_NAME as TIC72_154_, ticket0_.TICK_TRANSIT_DOC_ADDR_STR_DESC as TIC73_154_, ticket0_.TICK_TRANSIT_DOC_ADDR_NUM as TIC74_154_, ticket0_.TICK_TRANSIT_DOC_CITY as TIC75_154_, ticket0_.TICK_TRANSIT_DOC_POSTAL_CODE as TIC76_154_, ticket0_.TICK_LOCATION_SIGN_DESCRIPTION as TIC77_154_, ticket0_.TICK_SITUATIONS_DESCRIPTION as TIC78_154_, ticket0_.TICK_IS_TOWING as TIC79_154_, ticket0_.TICK_CLOSE_DATE as TIC80_154_, ticket0_.TICK_CLOSE_DATE_UTC as TIC81_154_, ticket0_.TICK_PRINTED_TICKET as TIC82_154_, ticket0_.TICK_PRINTED_TICKET_2 as TIC83_154_, ticket0_.TICK_PRINTED_TICKET_3 as TIC84_154_, ticket0_.TICK_PRINTED_TICKET_4 as TIC85_154_, ticket0_.TICK_PRINTED_TICKET_PRE_IMG as TIC86_154_, ticket0_.TICK_PRINTED_TICKET_PRE_IMG_2 as TIC87_154_, ticket0_.TICK_PRINTED_TICKET_PRE_IMG_3 as TIC88_154_, ticket0_.TICK_PRINTED_TICKET_PRE_IMG_4 as TIC89_154_, ticket0_.TICK_PRINTED_TICKET_OFFSET as TIC90_154_, ticket0_.TICK_PRINTED_TICKET_OFFSET_2 as TIC91_154_, ticket0_.TICK_PRINTED_TICKET_OFFSET_3 as TIC92_154_, ticket0_.TICK_PRINTED_TICKET_OFFSET_4 as TIC93_154_, ticket0_.TICK_NUMBER_EXT as TIC94_154_, ticket0_.TICK_STATUS_EXT as TIC95_154_, ticket0_.TICK_AMOUNT_OVERRIDE as TIC96_154_, ticket0_.TICK_IS_PAYABLE as TIC97_154_, ticket0_.TICK_WITH_CONTEXT_PHOTO as TIC98_154_, ticket0_.TICK_PARKING_SPACES_NUMBER_PAID as TIC99_154_, ticket0_.TICK_MINUTES_WITHOUT_PARKING_PAID as TI100_154_, ticket0_.TICK_PAYMENT_SOURCE_STRING_ID as TI101_154_, ticket0_.TICK_ADDST_ID as TI102_154_, ticket0_.TICK_PAY_CUR_ID as TI103_154_, ticket0_.TICK_ENFQUE_ID as TI104_154_, ticket0_.TICK_PAY_EXTPRO_ID as TI105_154_, ticket0_.TICK_GRP_ID as TI106_154_, ticket0_.TICK_INSPS_ID as TI107_154_, ticket0_.TICK_INS_ID as TI108_154_, ticket0_.TICK_MODE_ID as TI109_154_, ticket0_.TICK_MOSE_ID as TI110_154_, ticket0_.TICK_PDM_ID as TI111_154_, ticket0_.TICK_REGR_ID as TI112_154_, ticket0_.TICK_STR_ID as TI113_154_, ticket0_.TICK_STR_ID_TO as TI114_154_, ticket0_.TICK_STR_ID_FROM as TI115_154_, ticket0_.TICK_INTERSECTION_STR_ID as TI116_154_, ticket0_.TICK_STSE_ID as TI117_154_, ticket0_.TICK_LOCATION_SIGN_ID as TI118_154_, ticket0_.TICK_SITUATIONS_ID as TI119_154_, ticket0_.TICK_STATUS_ID as TI120_154_, ticket0_.TICK_TITY_ID as TI121_154_, ticket0_.TICK_TVESERV_ID as TI122_154_, ticket0_.TICK_USR_ID as TI123_154_, ticket0_.TICK_VBRAND_ID as TI124_154_, ticket0_.TICK_VCOLOR_ID as TI125_154_, ticket0_.TICK_VENTITY_ID as TI126_154_, ticket0_.TICK_VMODEL_ID as TI127_154_, ticket0_.TICK_VEH_ID as TI128_154_, ticket0_.TICK_VTYPE_ID as TI129_154_, ticket0_.TICK_TAR_ID as TI130_154_, ticket0_.TICK_PS_ID as TI131_154_ from TICKETS ticket0_ where ticket0_.TICK_INS_ID=:p0 and ticket0_.TICK_STATUS_ID<>:p1 order by ticket0_.TICK_ID desc ]
Name:p1 - Value:40064 Name:p2 - Value:6
[SQL: select ticket0_.TICK_ID as TICK1_154_, ticket0_.TICK_NUMBER as TICK2_154_, ticket0_.TICK_IMEI as TICK3_154_, ticket0_.TICK_CELL_WIFI_MAC as TICK4_154_, ticket0_.TICK_CELL_BLUETOOTH_MAC as TICK5_154_, ticket0_.TICK_DATE as TICK6_154_, ticket0_.TICK_UTC_DATE as TICK7_154_, ticket0_.TICK_LPR_PLATE as TICK8_154_, ticket0_.TICK_QUERY_PLATE as TICK9_154_, ticket0_.TICK_QUERY_EQ_LPR_PLATE as TIC10_154_, ticket0_.TICK_STR_NUMBER as TIC11_154_, ticket0_.TICK_LATITUDE as TIC12_154_, ticket0_.TICK_LONGITUDE as TIC13_154_, ticket0_.TICK_IMAGE_URL as TIC14_154_, ticket0_.TICK_PAY_AMOUNT as TIC15_154_, ticket0_.TICK_STATUS_DATE as TIC16_154_, ticket0_.TICK_STATUS_DATE_UTC as TIC17_154_, ticket0_.TICK_PAY_EXTPRO_OP_ID as TIC18_154_, ticket0_.TICK_PAY_EXTPRO_PAY_ENTITY as TIC19_154_, ticket0_.TICK_MAXPAYDATE as TIC20_154_, ticket0_.TICK_PARKING_INIDATE as TIC21_154_, ticket0_.TICK_PARKING_ENDDATE as TIC22_154_, ticket0_.TICK_PARKING_TIME as TIC23_154_, ticket0_.TICK_SELECTED_PLATE as TIC24_154_, ticket0_.TICK_FINE_NUMBER as TIC25_154_, ticket0_.TICK_STR_NUMBER_FROM as TIC26_154_, ticket0_.TICK_STR_NUMBER_TO as TIC27_154_, ticket0_.TICK_AMOUNT as TIC28_154_, ticket0_.TICK_SYNC_MANAGED as TIC29_154_, ticket0_.TICK_BALANCE as TIC30_154_, ticket0_.TICK_INITIAL_AMOUNT as TIC31_154_, ticket0_.TICK_AGING2_DATE as TIC32_154_, ticket0_.TICK_AGING2_UTCDATE as TIC33_154_, ticket0_.TICK_AGING2_AMOUNT as TIC34_154_, ticket0_.TICK_AGING3_DATE as TIC35_154_, ticket0_.TICK_AGING3_UTCDATE as TIC36_154_, ticket0_.TICK_AGING3_AMOUNT as TIC37_154_, ticket0_.TICK_AGING4_DATE as TIC38_154_, ticket0_.TICK_AGING4_UTCDATE as TIC39_154_, ticket0_.TICK_AGING4_AMOUNT as TIC40_154_, ticket0_.TICK_AGING5_DATE as TIC41_154_, ticket0_.TICK_AGING5_UTCDATE as TIC42_154_, ticket0_.TICK_AGING5_AMOUNT as TIC43_154_, ticket0_.TICK_PUBLIC_NOTES as TIC44_154_, ticket0_.TICK_PRIVATE_NOTES as TIC45_154_, ticket0_.TICK_ID_TYPE as TIC46_154_, ticket0_.TICK_TRANSIT_DOCUMENTISSUEDATE as TIC47_154_, ticket0_.TICK_TRANSIT_DOCUMENTEXPDATE as TIC48_154_, ticket0_.TICK_IS_WARNING as TIC49_154_, ticket0_.TICK_IS_SENTBYPOSTALMAIL as TIC50_154_, ticket0_.TICK_FEE_INITIAL_AMOUNT as TIC51_154_, ticket0_.TICK_FEE_AGING2_AMOUNT as TIC52_154_, ticket0_.TICK_FEE_AGING3_AMOUNT as TIC53_154_, ticket0_.TICK_FEE_AGING4_AMOUNT as TIC54_154_, ticket0_.TICK_FEE_AGING5_AMOUNT as TIC55_154_, ticket0_.TICK_TOWING_INITIAL_AMOUNT as TIC56_154_, ticket0_.TICK_TOWING_AGING2_AMOUNT as TIC57_154_, ticket0_.TICK_TOWING_AGING3_AMOUNT as TIC58_154_, ticket0_.TICK_TOWING_AGING4_AMOUNT as TIC59_154_, ticket0_.TICK_TOWING_AGING5_AMOUNT as TIC60_154_, ticket0_.TICK_FEE2_INITIAL_AMOUNT as TIC61_154_, ticket0_.TICK_FEE2_AGING2_AMOUNT as TIC62_154_, ticket0_.TICK_FEE2_AGING3_AMOUNT as TIC63_154_, ticket0_.TICK_FEE2_AGING4_AMOUNT as TIC64_154_, ticket0_.TICK_FEE2_AGING5_AMOUNT as TIC65_154_, ticket0_.TICK_TOTAL_INITIAL_AMOUNT as TIC66_154_, ticket0_.TICK_TOTAL_AGING2_AMOUNT as TIC67_154_, ticket0_.TICK_TOTAL_AGING3_AMOUNT as TIC68_154_, ticket0_.TICK_TOTAL_AGING4_AMOUNT as TIC69_154_, ticket0_.TICK_TOTAL_AGING5_AMOUNT as TIC70_154_, ticket0_.TICK_VIN as TIC71_154_, ticket0_.TICK_TRANSIT_DOC_NAME as TIC72_154_, ticket0_.TICK_TRANSIT_DOC_ADDR_STR_DESC as TIC73_154_, ticket0_.TICK_TRANSIT_DOC_ADDR_NUM as TIC74_154_, ticket0_.TICK_TRANSIT_DOC_CITY as TIC75_154_, ticket0_.TICK_TRANSIT_DOC_POSTAL_CODE as TIC76_154_, ticket0_.TICK_LOCATION_SIGN_DESCRIPTION as TIC77_154_, ticket0_.TICK_SITUATIONS_DESCRIPTION as TIC78_154_, ticket0_.TICK_IS_TOWING as TIC79_154_, ticket0_.TICK_CLOSE_DATE as TIC80_154_, ticket0_.TICK_CLOSE_DATE_UTC as TIC81_154_, ticket0_.TICK_PRINTED_TICKET as TIC82_154_, ticket0_.TICK_PRINTED_TICKET_2 as TIC83_154_, ticket0_.TICK_PRINTED_TICKET_3 as TIC84_154_, ticket0_.TICK_PRINTED_TICKET_4 as TIC85_154_, ticket0_.TICK_PRINTED_TICKET_PRE_IMG as TIC86_154_, ticket0_.TICK_PRINTED_TICKET_PRE_IMG_2 as TIC87_154_, ticket0_.TICK_PRINTED_TICKET_PRE_IMG_3 as TIC88_154_, ticket0_.TICK_PRINTED_TICKET_PRE_IMG_4 as TIC89_154_, ticket0_.TICK_PRINTED_TICKET_OFFSET as TIC90_154_, ticket0_.TICK_PRINTED_TICKET_OFFSET_2 as TIC91_154_, ticket0_.TICK_PRINTED_TICKET_OFFSET_3 as TIC92_154_, ticket0_.TICK_PRINTED_TICKET_OFFSET_4 as TIC93_154_, ticket0_.TICK_NUMBER_EXT as TIC94_154_, ticket0_.TICK_STATUS_EXT as TIC95_154_, ticket0_.TICK_AMOUNT_OVERRIDE as TIC96_154_, ticket0_.TICK_IS_PAYABLE as TIC97_154_, ticket0_.TICK_WITH_CONTEXT_PHOTO as TIC98_154_, ticket0_.TICK_PARKING_SPACES_NUMBER_PAID as TIC99_154_, ticket0_.TICK_MINUTES_WITHOUT_PARKING_PAID as TI100_154_, ticket0_.TICK_PAYMENT_SOURCE_STRING_ID as TI101_154_, ticket0_.TICK_ADDST_ID as TI102_154_, ticket0_.TICK_PAY_CUR_ID as TI103_154_, ticket0_.TICK_ENFQUE_ID as TI104_154_, ticket0_.TICK_PAY_EXTPRO_ID as TI105_154_, ticket0_.TICK_GRP_ID as TI106_154_, ticket0_.TICK_INSPS_ID as TI107_154_, ticket0_.TICK_INS_ID as TI108_154_, ticket0_.TICK_MODE_ID as TI109_154_, ticket0_.TICK_MOSE_ID as TI110_154_, ticket0_.TICK_PDM_ID as TI111_154_, ticket0_.TICK_REGR_ID as TI112_154_, ticket0_.TICK_STR_ID as TI113_154_, ticket0_.TICK_STR_ID_TO as TI114_154_, ticket0_.TICK_STR_ID_FROM as TI115_154_, ticket0_.TICK_INTERSECTION_STR_ID as TI116_154_, ticket0_.TICK_STSE_ID as TI117_154_, ticket0_.TICK_LOCATION_SIGN_ID as TI118_154_, ticket0_.TICK_SITUATIONS_ID as TI119_154_, ticket0_.TICK_STATUS_ID as TI120_154_, ticket0_.TICK_TITY_ID as TI121_154_, ticket0_.TICK_TVESERV_ID as TI122_154_, ticket0_.TICK_USR_ID as TI123_154_, ticket0_.TICK_VBRAND_ID as TI124_154_, ticket0_.TICK_VCOLOR_ID as TI125_154_, ticket0_.TICK_VENTITY_ID as TI126_154_, ticket0_.TICK_VMODEL_ID as TI127_154_, ticket0_.TICK_VEH_ID as TI128_154_, ticket0_.TICK_VTYPE_ID as TI129_154_, ticket0_.TICK_TAR_ID as TI130_154_, ticket0_.TICK_PS_ID as TI131_154_ from TICKETS ticket0_ where ticket0_.TICK_INS_ID=:p0 and ticket0_.TICK_STATUS_ID<>:p1 order by ticket0_.TICK_ID desc]

Below is the Stack Trace :

at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters, IResultTransformer forcedResultTransformer)
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Loader.Hql.QueryLoader.List(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters queryParameters, ISessionImplementor session, IList results)
at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
at NHibernate.Impl.AbstractSessionImpl.List(IQueryExpression queryExpression, QueryParameters parameters)
at NHibernate.Impl.AbstractQueryImpl2.List()
at NHibernate.Linq.DefaultQueryProvider.ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression)
at NHibernate.Linq.DefaultQueryProvider.Execute[TResult](Expression expression)
at Remotion.Linq.QueryableBase1.GetEnumerator() at System.Collections.Generic.List1…ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at iParkTicketInfrastructure.Repositories.TicketAppealRepository.GetNPTickets(String InsId) in D:\IntegraParking_Projects\iParkTicketInfrastructure\Repositories\TicketAppealRepository.cs:line 103

{ORA-00904: “TICKET0_”.“TICK_PS_ID”: invalid identifier\n}

Any solution would be appreciated, it took me days but still not get resolved.

Thank you

Hi @Wani_Mudasir

This forum is for NServiceBus and the Particular Service Platform so you might have more luck on a forum specific to NHibernate or on StackOverflow.

That said, I’d take a look at your tickets table and see if there is a TICK_PS_ID column. The exception message suggests that this column is missing so you might need to update your DDL.

Good luck!
– Kyle

Hi @Kyle_Baley ,

Thanks for the update, as you mentioned the TICK_PS_ID column, there is not column exists in TICKETS db table even not in the Entity Framework generated model (Tickets Model). I don’t know why this is giving me this exception.

Basically I migrated the Entity Framework Linq queries to NHibernate for the purpose, and after that, I’m not able to run queries based on NHibernate.

In that case, I suggest checking out a forum specific to NHibernate and trying on StackOverflow. This forum is for NServiceBus and the related Particular Service Platform tools. While NHibernate is one of our integration points, our expertise is around messaging and distributed systems design and implementation.