-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Problem loading object by ID: InvalidCastException
PostPosted: Thu Jun 24, 2010 3:45 pm 
Newbie

Joined: Thu Jun 24, 2010 3:33 pm
Posts: 2
I am getting an object returned but it's a hashtable collection and I cannot cast to my NHTest class because I am getting an InvalidCastException. What am I missing?

Code:
Dim objAdr As NHTest = sess.Get(GetType(NHTest), id)


Here is my NHTest class:

Code:

  Public Class NHTest

    Public strAdrId As String
    Public strAdr1 As String
    Public strAdr2 As String
    Public strCityNbr As String
    Public strCity As String
    Public strStateCode As String
    Public strPostCd As String
    Public strCtrCd As String
    Public strAdrInd As String
    Public strUserId As String
    Public strStatusCd As String
    Public strTerminalId As String
    Public dtEffAcy As Date


    Public Overridable Property ADR_ID() As String
      Get
        Return strAdrId
      End Get
      Set(ByVal value As String)
        strAdrId = value
      End Set
    End Property

    Public Overridable Property CICA_ADR_1() As String
      Get
        Return strAdr1
      End Get
      Set(ByVal value As String)
        strAdr1 = value
      End Set
    End Property

    Public Overridable Property CICA_ADR_2() As String
      Get
        Return strAdr2
      End Get
      Set(ByVal value As String)
        strAdr2 = value
      End Set
    End Property

    Public Overridable Property CICA_CIT_NM() As String
      Get
        Return strCityNbr
      End Get
      Set(ByVal value As String)
        strCityNbr = value
      End Set
    End Property

    Public Overridable Property CICA_CTY() As String
      Get
        Return strCity
      End Get
      Set(ByVal value As String)
        strCity = value
      End Set
    End Property

    Public Overridable Property ST_CD() As String
      Get
        Return strStateCode
      End Get
      Set(ByVal value As String)
        strStateCode = value
      End Set
    End Property

    Public Overridable Property CICA_PST_CD() As String
      Get
        Return strPostCd
      End Get
      Set(ByVal value As String)
        strPostCd = value
      End Set
    End Property

    Public Overridable Property CTR_CD() As String
      Get
        Return strCtrCd
      End Get
      Set(ByVal value As String)
        strCtrCd = value
      End Set
    End Property

    Public Overridable Property CICA_ADD_ADR_IND() As String
      Get
        Return strAdrInd
      End Get
      Set(ByVal value As String)
        strAdrInd = value
      End Set
    End Property

    Public Overridable Property USER_ID() As String
      Get
        Return strUserId
      End Get
      Set(ByVal value As String)
        strUserId = value
      End Set
    End Property

    Public Overridable Property STATUS_CD() As String
      Get
        Return strStatusCd
      End Get
      Set(ByVal value As String)
        strStatusCd = value
      End Set
    End Property

    Public Overridable Property TERMINAL_ID() As String
      Get
        Return strTerminalId
      End Get
      Set(ByVal value As String)
        strTerminalId = value
      End Set
    End Property

    Public Overridable Property CICA_EFF_ACY_TS() As Date
      Get
        Return dtEffAcy
      End Get
      Set(ByVal value As Date)
        dtEffAcy = value
      End Set
    End Property

  End Class


Here is the mapping file:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="NHTest"
                   namespace="NHTest">

  <class entity-name="NHTest" table="Table">
    <id name="ADR_ID" type="String" >
      <generator class="sequence"></generator>
    </id>
    <property name="CICA_ADR_1" type="String"></property>
    <property name="CICA_ADR_2" type="String"></property>
    <property name="CICA_CIT_NM" type="String"></property>
    <property name="CICA_CTY" type="String"></property>
    <property name="ST_CD" type="String"></property>
    <property name="CICA_PST_CD" type="String"></property>
    <property name="CTR_CD" type="String"></property>
    <property name="CICA_ADD_ADR_IND" type="String"></property>
    <property name="USER_ID" type="String"></property>
    <property name="STATUS_CD" type="String"></property>
    <property name="TERMINAL_ID" type="String"></property>
    <property name="CICA_EFF_ACY_TS" type="Date"></property>
  </class>
</hibernate-mapping>


Here is the log:

Code:
2010-07-08 17:01:13,780 [11] INFO  NHibernate.Cfg.Environment - NHibernate 2.1.2.4000 (2.1.2.4000)
2010-07-08 17:01:13,842 [11] INFO  NHibernate.Cfg.Environment - Bytecode provider name : lcg
2010-07-08 17:01:13,842 [11] INFO  NHibernate.Cfg.Environment - Using reflection optimizer
2010-07-08 17:01:13,874 [11] DEBUG NHibernate.Cfg.Configuration - dialect=NHibernate.Dialect.DB2Dialect
2010-07-08 17:01:13,874 [11] DEBUG NHibernate.Cfg.Configuration - connection.provider=NHibernate.Connection.DriverConnectionProvider
2010-07-08 17:01:13,874 [11] DEBUG NHibernate.Cfg.Configuration - connection.connection_string=Database=HOSTDB3U;User ID=icsics;Password=icsweb10
2010-07-08 17:01:13,874 [11] DEBUG NHibernate.Cfg.Configuration - proxyfactory.factory_class=NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu
2010-07-08 17:01:13,874 [11] DEBUG NHibernate.Cfg.Configuration - show_sql=true
2010-07-08 17:01:13,874 [11] DEBUG NHibernate.Cfg.Configuration - <-Business
2010-07-08 17:01:13,874 [11] INFO  NHibernate.Cfg.Configuration - Searching for mapped documents in assembly: Business
2010-07-08 17:01:13,889 [11] INFO  NHibernate.Cfg.Configuration - Mapping resource: Business.NHTest.hbm.xml
2010-07-08 17:01:13,952 [11] INFO  NHibernate.Dialect.Dialect - Using dialect: NHibernate.Dialect.DB2Dialect
2010-07-08 17:01:16,155 [11] INFO  NHibernate.Cfg.XmlHbmBinding.Binder - Mapping class: Business.NHTest -> TPMR70C.CLIENT_ADDRESS
2010-07-08 17:01:16,280 [11] DEBUG NHibernate.Cfg.XmlHbmBinding.Binder - Mapped property: ADR_ID -> ADR_ID, type: String
2010-07-08 17:01:16,608 [11] DEBUG NHibernate.Cfg.XmlHbmBinding.Binder - Mapped property: CICA_ADR_1 -> CICA_ADR_1, type: String
2010-07-08 17:01:16,608 [11] DEBUG NHibernate.Cfg.XmlHbmBinding.Binder - Mapped property: CICA_ADR_2 -> CICA_ADR_2, type: String
2010-07-08 17:01:16,608 [11] DEBUG NHibernate.Cfg.XmlHbmBinding.Binder - Mapped property: CICA_CIT_NM -> CICA_CIT_NM, type: String
2010-07-08 17:01:16,608 [11] DEBUG NHibernate.Cfg.XmlHbmBinding.Binder - Mapped property: CICA_CTY -> CICA_CTY, type: String
2010-07-08 17:01:16,608 [11] DEBUG NHibernate.Cfg.XmlHbmBinding.Binder - Mapped property: ST_CD -> ST_CD, type: String
2010-07-08 17:01:16,608 [11] DEBUG NHibernate.Cfg.XmlHbmBinding.Binder - Mapped property: CICA_PST_CD -> CICA_PST_CD, type: String
2010-07-08 17:01:16,608 [11] DEBUG NHibernate.Cfg.XmlHbmBinding.Binder - Mapped property: CTR_CD -> CTR_CD, type: String
2010-07-08 17:01:16,608 [11] DEBUG NHibernate.Cfg.XmlHbmBinding.Binder - Mapped property: CICA_ADD_ADR_IND -> CICA_ADD_ADR_IND, type: String
2010-07-08 17:01:16,608 [11] DEBUG NHibernate.Cfg.XmlHbmBinding.Binder - Mapped property: USER_ID -> USER_ID, type: String
2010-07-08 17:01:16,608 [11] DEBUG NHibernate.Cfg.XmlHbmBinding.Binder - Mapped property: STATUS_CD -> STATUS_CD, type: String
2010-07-08 17:01:16,608 [11] DEBUG NHibernate.Cfg.XmlHbmBinding.Binder - Mapped property: TERMINAL_ID -> TERMINAL_ID, type: String
2010-07-08 17:01:16,608 [11] DEBUG NHibernate.Cfg.XmlHbmBinding.Binder - Mapped property: CICA_EFF_ACY_TS -> CICA_EFF_ACY_TS, type: DateTime
2010-07-08 17:01:16,624 [11] DEBUG NHibernate.Cfg.Configuration - properties: System.Collections.Generic.Dictionary`2[System.String,System.String]
2010-07-08 17:01:16,733 [11] INFO  NHibernate.Cfg.Configuration - checking mappings queue
2010-07-08 17:01:16,733 [11] INFO  NHibernate.Cfg.Configuration - processing one-to-many association mappings
2010-07-08 17:01:16,733 [11] INFO  NHibernate.Cfg.Configuration - processing one-to-one association property references
2010-07-08 17:01:16,733 [11] INFO  NHibernate.Cfg.Configuration - processing foreign key constraints
2010-07-08 17:01:16,733 [11] INFO  NHibernate.Cfg.Configuration - processing filters (second pass)
2010-07-08 17:01:16,764 [11] INFO  NHibernate.Dialect.Dialect - Using dialect: NHibernate.Dialect.DB2Dialect
2010-07-08 17:01:16,780 [11] INFO  NHibernate.Exceptions.SQLExceptionConverterFactory - Using dialect defined converter
2010-07-08 17:01:16,796 [11] INFO  NHibernate.Cfg.SettingsFactory - Generate SQL with comments: disabled
2010-07-08 17:01:16,811 [11] INFO  NHibernate.Connection.ConnectionProviderFactory - Initializing connection provider: NHibernate.Connection.DriverConnectionProvider
2010-07-08 17:01:16,811 [11] INFO  NHibernate.Connection.ConnectionProvider - Configuring ConnectionProvider
2010-07-08 17:01:16,983 [11] INFO  NHibernate.Cfg.SettingsFactory - Transaction factory: NHibernate.Transaction.AdoNetWithDistrubtedTransactionFactory
2010-07-08 17:01:16,999 [11] INFO  NHibernate.Cfg.SettingsFactory - Optimize cache for minimal puts: False
2010-07-08 17:01:16,999 [11] INFO  NHibernate.Cfg.SettingsFactory - Connection release mode: auto
2010-07-08 17:01:16,999 [11] INFO  NHibernate.Cfg.SettingsFactory - Default batch fetch size: 1
2010-07-08 17:01:16,999 [11] INFO  NHibernate.Cfg.SettingsFactory - echoing all SQL to stdout
2010-07-08 17:01:16,999 [11] INFO  NHibernate.Cfg.SettingsFactory - Statistics: disabled
2010-07-08 17:01:16,999 [11] INFO  NHibernate.Cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
2010-07-08 17:01:16,999 [11] INFO  NHibernate.Cfg.SettingsFactory - Query translator: NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory
2010-07-08 17:01:17,046 [11] INFO  NHibernate.Cfg.SettingsFactory - Query language substitutions: {}
2010-07-08 17:01:17,046 [11] INFO  NHibernate.Cfg.SettingsFactory - cache provider: NHibernate.Cache.NoCacheProvider, NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
2010-07-08 17:01:17,046 [11] DEBUG NHibernate.Cfg.SettingsFactory - Wrap result sets: disabled
2010-07-08 17:01:17,046 [11] INFO  NHibernate.Cfg.SettingsFactory - Batcher factory: NHibernate.AdoNet.NonBatchingBatcherFactory, NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
2010-07-08 17:01:17,046 [11] INFO  NHibernate.Cfg.SettingsFactory - Default entity-mode: Poco
2010-07-08 17:01:17,046 [11] INFO  NHibernate.Cfg.SettingsFactory - Named query checking : enabled
2010-07-08 17:01:17,061 [11] INFO  NHibernate.Impl.SessionFactoryImpl - building session factory
2010-07-08 17:01:17,061 [11] DEBUG NHibernate.Impl.SessionFactoryImpl - Session factory constructed with filter configurations : {}
2010-07-08 17:01:17,061 [11] DEBUG NHibernate.Impl.SessionFactoryImpl - instantiating session factory with properties: {'use_reflection_optimizer'='True', 'bytecode.provider'='lcg', 'dialect'='NHibernate.Dialect.DB2Dialect', 'connection.provider'='NHibernate.Connection.DriverConnectionProvider', 'connection.connection_string'='Database=HOSTDB3U;User ID=icsics;Password=icsweb10', 'proxyfactory.factory_class'='NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu', 'show_sql'='true'}
2010-07-08 17:01:17,077 [11] DEBUG NHibernate.Connection.DriverConnectionProvider - Obtaining IDbConnection from Driver
2010-07-08 17:01:17,811 [11] DEBUG NHibernate.Connection.ConnectionProvider - Closing connection
2010-07-08 17:01:18,061 [11] DEBUG NHibernate.Tuple.Entity.AbstractEntityTuplizer - No custom accessors found for entity: Business.NHTest
2010-07-08 17:01:18,389 [11] DEBUG NHibernate.Persister.Entity.AbstractEntityPersister - Static SQL for entity: Business.NHTest
2010-07-08 17:01:18,389 [11] DEBUG NHibernate.Persister.Entity.AbstractEntityPersister -  Version select: SELECT ADR_ID FROM TPMR70C.CLIENT_ADDRESS WHERE ADR_ID = ?
2010-07-08 17:01:18,389 [11] DEBUG NHibernate.Persister.Entity.AbstractEntityPersister -  Snapshot select: SELECT nhtest_.ADR_ID, nhtest_.CICA_ADR_1 as CICA2_0_, nhtest_.CICA_ADR_2 as CICA3_0_, nhtest_.CICA_CIT_NM as CICA4_0_, nhtest_.CICA_CTY as CICA5_0_, nhtest_.ST_CD as ST6_0_, nhtest_.CICA_PST_CD as CICA7_0_, nhtest_.CTR_CD as CTR8_0_, nhtest_.CICA_ADD_ADR_IND as CICA9_0_, nhtest_.USER_ID as USER10_0_, nhtest_.STATUS_CD as STATUS11_0_, nhtest_.TERMINAL_ID as TERMINAL12_0_, nhtest_.CICA_EFF_ACY_TS as CICA13_0_ FROM TPMR70C.CLIENT_ADDRESS nhtest_ WHERE nhtest_.ADR_ID=?
2010-07-08 17:01:18,389 [11] DEBUG NHibernate.Persister.Entity.AbstractEntityPersister -  Insert 0: INSERT INTO TPMR70C.CLIENT_ADDRESS (CICA_ADR_1, CICA_ADR_2, CICA_CIT_NM, CICA_CTY, ST_CD, CICA_PST_CD, CTR_CD, CICA_ADD_ADR_IND, USER_ID, STATUS_CD, TERMINAL_ID, CICA_EFF_ACY_TS, ADR_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2010-07-08 17:01:18,389 [11] DEBUG NHibernate.Persister.Entity.AbstractEntityPersister -  Update 0: UPDATE TPMR70C.CLIENT_ADDRESS SET CICA_ADR_1 = ?, CICA_ADR_2 = ?, CICA_CIT_NM = ?, CICA_CTY = ?, ST_CD = ?, CICA_PST_CD = ?, CTR_CD = ?, CICA_ADD_ADR_IND = ?, USER_ID = ?, STATUS_CD = ?, TERMINAL_ID = ?, CICA_EFF_ACY_TS = ? WHERE ADR_ID = ?
2010-07-08 17:01:18,389 [11] DEBUG NHibernate.Persister.Entity.AbstractEntityPersister -  Delete 0: DELETE FROM TPMR70C.CLIENT_ADDRESS WHERE ADR_ID = ?
2010-07-08 17:01:18,389 [11] DEBUG NHibernate.Persister.Entity.AbstractEntityPersister -  Identity insert: INSERT INTO TPMR70C.CLIENT_ADDRESS (ADR_ID, CICA_ADR_1, CICA_ADR_2, CICA_CIT_NM, CICA_CTY, ST_CD, CICA_PST_CD, CTR_CD, CICA_ADD_ADR_IND, USER_ID, STATUS_CD, TERMINAL_ID, CICA_EFF_ACY_TS) VALUES (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2010-07-08 17:01:18,780 [11] DEBUG NHibernate.Loader.Entity.AbstractEntityLoader - Static select for entity Business.NHTest: SELECT nhtest0_.ADR_ID as ADR1_0_0_, nhtest0_.CICA_ADR_1 as CICA2_0_0_, nhtest0_.CICA_ADR_2 as CICA3_0_0_, nhtest0_.CICA_CIT_NM as CICA4_0_0_, nhtest0_.CICA_CTY as CICA5_0_0_, nhtest0_.ST_CD as ST6_0_0_, nhtest0_.CICA_PST_CD as CICA7_0_0_, nhtest0_.CTR_CD as CTR8_0_0_, nhtest0_.CICA_ADD_ADR_IND as CICA9_0_0_, nhtest0_.USER_ID as USER10_0_0_, nhtest0_.STATUS_CD as STATUS11_0_0_, nhtest0_.TERMINAL_ID as TERMINAL12_0_0_, nhtest0_.CICA_EFF_ACY_TS as CICA13_0_0_ FROM TPMR70C.CLIENT_ADDRESS nhtest0_ WHERE nhtest0_.ADR_ID=?
2010-07-08 17:01:18,780 [11] DEBUG NHibernate.Loader.Entity.AbstractEntityLoader - Static select for entity Business.NHTest: SELECT nhtest0_.ADR_ID as ADR1_0_0_, nhtest0_.CICA_ADR_1 as CICA2_0_0_, nhtest0_.CICA_ADR_2 as CICA3_0_0_, nhtest0_.CICA_CIT_NM as CICA4_0_0_, nhtest0_.CICA_CTY as CICA5_0_0_, nhtest0_.ST_CD as ST6_0_0_, nhtest0_.CICA_PST_CD as CICA7_0_0_, nhtest0_.CTR_CD as CTR8_0_0_, nhtest0_.CICA_ADD_ADR_IND as CICA9_0_0_, nhtest0_.USER_ID as USER10_0_0_, nhtest0_.STATUS_CD as STATUS11_0_0_, nhtest0_.TERMINAL_ID as TERMINAL12_0_0_, nhtest0_.CICA_EFF_ACY_TS as CICA13_0_0_ FROM TPMR70C.CLIENT_ADDRESS nhtest0_ WHERE nhtest0_.ADR_ID=?
2010-07-08 17:01:18,780 [11] DEBUG NHibernate.SqlCommand.SqlSelectBuilder - The initial capacity was set too low at: 8 for the SelectSqlBuilder that needed a capacity of: 9 for the table TPMR70C.CLIENT_ADDRESS nhtest0_
2010-07-08 17:01:18,780 [11] DEBUG NHibernate.Loader.Entity.AbstractEntityLoader - Static select for entity Business.NHTest: SELECT nhtest0_.ADR_ID as ADR1_0_0_, nhtest0_.CICA_ADR_1 as CICA2_0_0_, nhtest0_.CICA_ADR_2 as CICA3_0_0_, nhtest0_.CICA_CIT_NM as CICA4_0_0_, nhtest0_.CICA_CTY as CICA5_0_0_, nhtest0_.ST_CD as ST6_0_0_, nhtest0_.CICA_PST_CD as CICA7_0_0_, nhtest0_.CTR_CD as CTR8_0_0_, nhtest0_.CICA_ADD_ADR_IND as CICA9_0_0_, nhtest0_.USER_ID as USER10_0_0_, nhtest0_.STATUS_CD as STATUS11_0_0_, nhtest0_.TERMINAL_ID as TERMINAL12_0_0_, nhtest0_.CICA_EFF_ACY_TS as CICA13_0_0_ FROM TPMR70C.CLIENT_ADDRESS nhtest0_ WHERE nhtest0_.ADR_ID=? for read only with rs
2010-07-08 17:01:18,780 [11] DEBUG NHibernate.SqlCommand.SqlSelectBuilder - The initial capacity was set too low at: 8 for the SelectSqlBuilder that needed a capacity of: 9 for the table TPMR70C.CLIENT_ADDRESS nhtest0_
2010-07-08 17:01:18,780 [11] DEBUG NHibernate.Loader.Entity.AbstractEntityLoader - Static select for entity Business.NHTest: SELECT nhtest0_.ADR_ID as ADR1_0_0_, nhtest0_.CICA_ADR_1 as CICA2_0_0_, nhtest0_.CICA_ADR_2 as CICA3_0_0_, nhtest0_.CICA_CIT_NM as CICA4_0_0_, nhtest0_.CICA_CTY as CICA5_0_0_, nhtest0_.ST_CD as ST6_0_0_, nhtest0_.CICA_PST_CD as CICA7_0_0_, nhtest0_.CTR_CD as CTR8_0_0_, nhtest0_.CICA_ADD_ADR_IND as CICA9_0_0_, nhtest0_.USER_ID as USER10_0_0_, nhtest0_.STATUS_CD as STATUS11_0_0_, nhtest0_.TERMINAL_ID as TERMINAL12_0_0_, nhtest0_.CICA_EFF_ACY_TS as CICA13_0_0_ FROM TPMR70C.CLIENT_ADDRESS nhtest0_ WHERE nhtest0_.ADR_ID=? for read only with rs
2010-07-08 17:01:18,780 [11] DEBUG NHibernate.SqlCommand.SqlSelectBuilder - The initial capacity was set too low at: 8 for the SelectSqlBuilder that needed a capacity of: 9 for the table TPMR70C.CLIENT_ADDRESS nhtest0_
2010-07-08 17:01:18,780 [11] DEBUG NHibernate.Loader.Entity.AbstractEntityLoader - Static select for entity Business.NHTest: SELECT nhtest0_.ADR_ID as ADR1_0_0_, nhtest0_.CICA_ADR_1 as CICA2_0_0_, nhtest0_.CICA_ADR_2 as CICA3_0_0_, nhtest0_.CICA_CIT_NM as CICA4_0_0_, nhtest0_.CICA_CTY as CICA5_0_0_, nhtest0_.ST_CD as ST6_0_0_, nhtest0_.CICA_PST_CD as CICA7_0_0_, nhtest0_.CTR_CD as CTR8_0_0_, nhtest0_.CICA_ADD_ADR_IND as CICA9_0_0_, nhtest0_.USER_ID as USER10_0_0_, nhtest0_.STATUS_CD as STATUS11_0_0_, nhtest0_.TERMINAL_ID as TERMINAL12_0_0_, nhtest0_.CICA_EFF_ACY_TS as CICA13_0_0_ FROM TPMR70C.CLIENT_ADDRESS nhtest0_ WHERE nhtest0_.ADR_ID=? for read only with rs
2010-07-08 17:01:18,780 [11] DEBUG NHibernate.Loader.Entity.AbstractEntityLoader - Static select for action NHibernate.Engine.CascadingAction+MergeCascadingAction on entity Business.NHTest: SELECT nhtest0_.ADR_ID as ADR1_0_0_, nhtest0_.CICA_ADR_1 as CICA2_0_0_, nhtest0_.CICA_ADR_2 as CICA3_0_0_, nhtest0_.CICA_CIT_NM as CICA4_0_0_, nhtest0_.CICA_CTY as CICA5_0_0_, nhtest0_.ST_CD as ST6_0_0_, nhtest0_.CICA_PST_CD as CICA7_0_0_, nhtest0_.CTR_CD as CTR8_0_0_, nhtest0_.CICA_ADD_ADR_IND as CICA9_0_0_, nhtest0_.USER_ID as USER10_0_0_, nhtest0_.STATUS_CD as STATUS11_0_0_, nhtest0_.TERMINAL_ID as TERMINAL12_0_0_, nhtest0_.CICA_EFF_ACY_TS as CICA13_0_0_ FROM TPMR70C.CLIENT_ADDRESS nhtest0_ WHERE nhtest0_.ADR_ID=?
2010-07-08 17:01:18,780 [11] DEBUG NHibernate.Loader.Entity.AbstractEntityLoader - Static select for action NHibernate.Engine.CascadingAction+RefreshCascadingAction on entity Business.NHTest: SELECT nhtest0_.ADR_ID as ADR1_0_0_, nhtest0_.CICA_ADR_1 as CICA2_0_0_, nhtest0_.CICA_ADR_2 as CICA3_0_0_, nhtest0_.CICA_CIT_NM as CICA4_0_0_, nhtest0_.CICA_CTY as CICA5_0_0_, nhtest0_.ST_CD as ST6_0_0_, nhtest0_.CICA_PST_CD as CICA7_0_0_, nhtest0_.CTR_CD as CTR8_0_0_, nhtest0_.CICA_ADD_ADR_IND as CICA9_0_0_, nhtest0_.USER_ID as USER10_0_0_, nhtest0_.STATUS_CD as STATUS11_0_0_, nhtest0_.TERMINAL_ID as TERMINAL12_0_0_, nhtest0_.CICA_EFF_ACY_TS as CICA13_0_0_ FROM TPMR70C.CLIENT_ADDRESS nhtest0_ WHERE nhtest0_.ADR_ID=?
2010-07-08 17:01:18,780 [11] DEBUG NHibernate.Impl.SessionFactoryObjectFactory - initializing class SessionFactoryObjectFactory
2010-07-08 17:01:18,780 [11] DEBUG NHibernate.Impl.SessionFactoryObjectFactory - registered: f549bc0235744dad946372faf1c38446(unnamed)
2010-07-08 17:01:18,780 [11] INFO  NHibernate.Impl.SessionFactoryObjectFactory - no name configured
2010-07-08 17:01:18,780 [11] DEBUG NHibernate.Impl.SessionFactoryImpl - Instantiated session factory
2010-07-08 17:01:18,780 [11] DEBUG NHibernate.Impl.SessionFactoryImpl - Checking 0 named HQL queries
2010-07-08 17:01:18,780 [11] DEBUG NHibernate.Impl.SessionFactoryImpl - Checking 0 named SQL queries
2010-07-08 17:01:18,796 [11] DEBUG NHibernate.Impl.SessionImpl - [session-id=55b24801-57ca-4bcd-bd61-43223158ae51] opened session at timestamp: 634142052787, for session factory: [/f549bc0235744dad946372faf1c38446]
2010-07-08 17:01:46,421 [11] DEBUG NHibernate.Event.Default.DefaultLoadEventListener - loading entity: [Business.NHTest#AAE8CPERIE80CLTADB3P]
2010-07-08 17:01:46,421 [11] DEBUG NHibernate.Event.Default.DefaultLoadEventListener - attempting to resolve: [Business.NHTest#AAE8CPERIE80CLTADB3P]
2010-07-08 17:01:46,421 [11] DEBUG NHibernate.Event.Default.DefaultLoadEventListener - object not resolved in any cache: [Business.NHTest#AAE8CPERIE80CLTADB3P]
2010-07-08 17:01:46,421 [11] DEBUG NHibernate.Persister.Entity.AbstractEntityPersister - Fetching entity: [Business.NHTest#AAE8CPERIE80CLTADB3P]
2010-07-08 17:01:46,421 [11] DEBUG NHibernate.Loader.Loader - loading entity: [Business.NHTest#AAE8CPERIE80CLTADB3P]
2010-07-08 17:01:46,467 [11] DEBUG NHibernate.AdoNet.AbstractBatcher - Opened new IDbCommand, open IDbCommands: 1
2010-07-08 17:01:46,467 [11] DEBUG NHibernate.AdoNet.AbstractBatcher - Building an IDbCommand object for the SqlString: SELECT nhtest0_.ADR_ID as ADR1_0_0_, nhtest0_.CICA_ADR_1 as CICA2_0_0_, nhtest0_.CICA_ADR_2 as CICA3_0_0_, nhtest0_.CICA_CIT_NM as CICA4_0_0_, nhtest0_.CICA_CTY as CICA5_0_0_, nhtest0_.ST_CD as ST6_0_0_, nhtest0_.CICA_PST_CD as CICA7_0_0_, nhtest0_.CTR_CD as CTR8_0_0_, nhtest0_.CICA_ADD_ADR_IND as CICA9_0_0_, nhtest0_.USER_ID as USER10_0_0_, nhtest0_.STATUS_CD as STATUS11_0_0_, nhtest0_.TERMINAL_ID as TERMINAL12_0_0_, nhtest0_.CICA_EFF_ACY_TS as CICA13_0_0_ FROM TPMR70C.CLIENT_ADDRESS nhtest0_ WHERE nhtest0_.ADR_ID=?
2010-07-08 17:01:46,467 [11] DEBUG NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.StringType) AAE8CPERIE80CLTADB3P -> [0]
2010-07-08 17:01:46,467 [11] DEBUG NHibernate.Type.StringType - binding 'AAE8CPERIE80CLTADB3P' to parameter: 0
2010-07-08 17:01:46,467 [11] INFO  NHibernate.Loader.Loader - SELECT nhtest0_.ADR_ID as ADR1_0_0_, nhtest0_.CICA_ADR_1 as CICA2_0_0_, nhtest0_.CICA_ADR_2 as CICA3_0_0_, nhtest0_.CICA_CIT_NM as CICA4_0_0_, nhtest0_.CICA_CTY as CICA5_0_0_, nhtest0_.ST_CD as ST6_0_0_, nhtest0_.CICA_PST_CD as CICA7_0_0_, nhtest0_.CTR_CD as CTR8_0_0_, nhtest0_.CICA_ADD_ADR_IND as CICA9_0_0_, nhtest0_.USER_ID as USER10_0_0_, nhtest0_.STATUS_CD as STATUS11_0_0_, nhtest0_.TERMINAL_ID as TERMINAL12_0_0_, nhtest0_.CICA_EFF_ACY_TS as CICA13_0_0_ FROM TPMR70C.CLIENT_ADDRESS nhtest0_ WHERE nhtest0_.ADR_ID=?
2010-07-08 17:01:46,483 [11] DEBUG NHibernate.SQL - SELECT nhtest0_.ADR_ID as ADR1_0_0_, nhtest0_.CICA_ADR_1 as CICA2_0_0_, nhtest0_.CICA_ADR_2 as CICA3_0_0_, nhtest0_.CICA_CIT_NM as CICA4_0_0_, nhtest0_.CICA_CTY as CICA5_0_0_, nhtest0_.ST_CD as ST6_0_0_, nhtest0_.CICA_PST_CD as CICA7_0_0_, nhtest0_.CTR_CD as CTR8_0_0_, nhtest0_.CICA_ADD_ADR_IND as CICA9_0_0_, nhtest0_.USER_ID as USER10_0_0_, nhtest0_.STATUS_CD as STATUS11_0_0_, nhtest0_.TERMINAL_ID as TERMINAL12_0_0_, nhtest0_.CICA_EFF_ACY_TS as CICA13_0_0_ FROM TPMR70C.CLIENT_ADDRESS nhtest0_ WHERE nhtest0_.ADR_ID=?;p0 = 'AAE8CPERIE80CLTADB3P'
2010-07-08 17:01:46,483 [11] DEBUG NHibernate.Connection.DriverConnectionProvider - Obtaining IDbConnection from Driver
2010-07-08 17:01:46,702 [11] DEBUG NHibernate.AdoNet.AbstractBatcher - ExecuteReader took 205 ms
2010-07-08 17:01:46,702 [11] DEBUG NHibernate.AdoNet.AbstractBatcher - Opened IDataReader, open IDataReaders: 1
2010-07-08 17:01:46,702 [11] DEBUG NHibernate.Loader.Loader - processing result set
2010-07-08 17:01:46,717 [11] DEBUG NHibernate.Loader.Loader - result set row: 0
2010-07-08 17:01:46,717 [11] DEBUG NHibernate.Loader.Loader - result row: EntityKey[Business.NHTest#AAE8CPERIE80CLTADB3P]
2010-07-08 17:01:46,717 [11] DEBUG NHibernate.Loader.Loader - Initializing object from DataReader: [Business.NHTest#AAE8CPERIE80CLTADB3P]
2010-07-08 17:01:46,733 [11] DEBUG NHibernate.Persister.Entity.AbstractEntityPersister - Hydrating entity: [Business.NHTest#AAE8CPERIE80CLTADB3P]
2010-07-08 17:01:46,733 [11] DEBUG NHibernate.Type.StringType - returning '238 COUNTY ROAD 2288                         ' as column: CICA2_0_0_
2010-07-08 17:01:46,733 [11] DEBUG NHibernate.Type.StringType - returning '                                             ' as column: CICA3_0_0_
2010-07-08 17:01:46,733 [11] DEBUG NHibernate.Type.StringType - returning 'GLENWOOD                      ' as column: CICA4_0_0_
2010-07-08 17:01:46,733 [11] DEBUG NHibernate.Type.StringType - returning null as column: CICA5_0_0_
2010-07-08 17:01:46,733 [11] DEBUG NHibernate.Type.StringType - returning 'AL ' as column: ST6_0_0_
2010-07-08 17:01:46,733 [11] DEBUG NHibernate.Type.StringType - returning '36034-3212   ' as column: CICA7_0_0_
2010-07-08 17:01:46,733 [11] DEBUG NHibernate.Type.StringType - returning 'USA ' as column: CTR8_0_0_
2010-07-08 17:01:46,733 [11] DEBUG NHibernate.Type.StringType - returning null as column: CICA9_0_0_
2010-07-08 17:01:46,733 [11] DEBUG NHibernate.Type.StringType - returning 'DB3PDX06' as column: USER10_0_0_
2010-07-08 17:01:46,733 [11] DEBUG NHibernate.Type.StringType - returning ' ' as column: STATUS11_0_0_
2010-07-08 17:01:46,733 [11] DEBUG NHibernate.Type.StringType - returning 'DB3P    ' as column: TERMINAL12_0_0_
2010-07-08 17:01:46,733 [11] DEBUG NHibernate.Type.DateTimeType - returning '7/24/2003 3:47:31 AM' as column: CICA13_0_0_
2010-07-08 17:01:46,733 [11] DEBUG NHibernate.Loader.Loader - done processing result set (1 rows)
2010-07-08 17:01:46,749 [11] DEBUG NHibernate.Driver.NHybridDataReader - running NHybridDataReader.Dispose()
2010-07-08 17:01:46,811 [11] DEBUG NHibernate.AdoNet.AbstractBatcher - Closed IDataReader, open IDataReaders :0
2010-07-08 17:01:46,811 [11] DEBUG NHibernate.AdoNet.AbstractBatcher - DataReader was closed after 324 ms
2010-07-08 17:01:46,827 [11] DEBUG NHibernate.AdoNet.AbstractBatcher - Closed IDbCommand, open IDbCommands: 0
2010-07-08 17:01:46,827 [11] DEBUG NHibernate.AdoNet.ConnectionManager - aggressively releasing database connection
2010-07-08 17:01:46,827 [11] DEBUG NHibernate.Connection.ConnectionProvider - Closing connection
2010-07-08 17:01:46,827 [11] DEBUG NHibernate.Loader.Loader - total objects hydrated: 1
2010-07-08 17:01:46,827 [11] DEBUG NHibernate.Engine.TwoPhaseLoad - resolving associations for [Business.NHTest#AAE8CPERIE80CLTADB3P]
2010-07-08 17:01:46,827 [11] DEBUG NHibernate.Engine.TwoPhaseLoad - done materializing entity [Business.NHTest#AAE8CPERIE80CLTADB3P]
2010-07-08 17:01:46,827 [11] DEBUG NHibernate.Engine.StatefulPersistenceContext - initializing non-lazy collections
2010-07-08 17:01:46,842 [11] DEBUG NHibernate.Loader.Loader - done entity load
2010-07-08 17:01:46,842 [11] DEBUG NHibernate.AdoNet.ConnectionManager - after autocommit
2010-07-08 17:01:46,842 [11] DEBUG NHibernate.Impl.SessionImpl - transaction completion
2010-07-08 17:01:46,842 [11] DEBUG NHibernate.AdoNet.ConnectionManager - aggressively releasing database connection
2010-07-08 17:01:50,342 [11] DEBUG NHibernate.Event.Default.DefaultLoadEventListener - loading entity: [Business.NHTest#AAE8CPERIE80CLTADB3P]
2010-07-08 17:01:50,342 [11] DEBUG NHibernate.Event.Default.DefaultLoadEventListener - attempting to resolve: [Business.NHTest#AAE8CPERIE80CLTADB3P]
2010-07-08 17:01:50,358 [11] DEBUG NHibernate.Event.Default.DefaultLoadEventListener - resolved object in session cache: [Business.NHTest#AAE8CPERIE80CLTADB3P]
2010-07-08 17:01:50,358 [11] DEBUG NHibernate.AdoNet.ConnectionManager - after autocommit
2010-07-08 17:01:50,358 [11] DEBUG NHibernate.Impl.SessionImpl - transaction completion
2010-07-08 17:01:50,358 [11] DEBUG NHibernate.AdoNet.ConnectionManager - aggressively releasing database connection



This is the exception returned:

Code:
System.InvalidCastException was unhandled
  Message="Unable to cast object of type 'System.Collections.Hashtable' to type 'NHTest'."
  Source="NHTestUI"


Why is Session.Get returning an object of type Hashtable? Why can't I cast to the NHTest class?

Any help would be greatly appreciated. Thanks!


Last edited by rsimons on Thu Jul 08, 2010 5:06 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Problem loading object by ID: InvalidCastException
PostPosted: Wed Jul 07, 2010 9:44 pm 
Newbie

Joined: Thu Jun 24, 2010 3:33 pm
Posts: 2
Has anyone else had this problem? Can someone at least offer a clue as to what I'm doing wrong?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.