-->
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 with Stored Procedures...
PostPosted: Tue May 26, 2009 9:38 am 
Newbie

Joined: Thu May 14, 2009 4:19 am
Posts: 12
I have the following Mapping file.
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" >
<class name="WindowsFormsSql.Model.TestInstrument, WindowsFormsSql" table="v_AllInstrumentsRak" lazy="false">
<composite-id>
<key-property name="Id" column="Id" type="string" ></key-property>
<key-property name="MarketId" column="MarketId" type="string"></key-property>
</composite-id>
<property name="Benchmark" column="Benchmark" />
<property name="BondPV01" column="BondPV01" />
<property name="ClosingPrice" column="ClosingPrice" />
<property name="Currency" column="Currency" />
<property name="DateMaturity" column="DateMaturity" />
<property name="DateSettlementWestminster" column="DateSettlementWestminster" />
<property name="DateSettlementIon" column="DateSettlementIon" />
<property name="Description" column="Description" />
<property name="DisplayName" column="DisplayName" />
<property name="IdCtd" column="IdCtd" />
<property name="MaturityBucket" column="MaturityBucket" />
<property name="NumberOfLegs" column="NumberOfLegs" />
<property name="OfficialId" column="OfficialId" />
<property name="OptionStrikePrice" column="OptionStrikePrice" />
<property name="QtyDec" column="QtyDec" />
<property name="QtyMax" column="QtyMax" />
<property name="QtyMin" column="QtyMin" />
<property name="QtyMinAggr" column="QtyMinAggr" />
<property name="QtyMinFAS" column="QtyMinFAS" />
<property name="QtyNominal" column="QtyNominal" />
<property name="QtyTick" column="QtyTick" />
<property name="QuoteQtyTick" column="QuoteQtyTick" />
<property name="QuotingSide" column="QuotingSide" />
<property name="SecurityType" column="SecurityType" />
<property name="StrategyType" column="StrategyType" />
<property name="Segment" column="Segment" />
<property name="SubMarket" column="SubMarket" />
<property name="ValueDec" column="ValueDec" />
<property name="ValueFmt" column="ValueFmt" />
<property name="ValueMax" column="ValueMax" />
<property name="ValueMin" column="ValueMin" />
<property name="ValueTick" column="ValueTick" />
<property name="ValueType" column="ValueType" />
<property name="ApplicationId" column="ApplicationId" />
</class>
<sql-query name="GetApplInstrumentsById" >
<return class="WindowsFormsSql.Model.TestInstrument, WindowsFormsSql" >
<return-property name="Id" column="Id" />
<return-property name="MarketId" column="MarketId" />
<return-property name="Benchmark" column="Benchmark" />
<return-property name="BondPV01" column="BondPV01" />
<return-property name="ClosingPrice" column="ClosingPrice" />
<return-property name="Currency" column="Currency" />
<return-property name="DateMaturity" column="DateMaturity" />
<return-property name="DateSettlementWestminster" column="DateSettlementWestminster" />
<return-property name="DateSettlementIon" column="DateSettlementIon" />
<return-property name="Description" column="Description" />
<return-property name="DisplayName" column="DisplayName" />
<return-property name="IdCtd" column="IdCtd" />
<return-property name="MaturityBucket" column="MaturityBucket" />
<return-property name="NumberOfLegs" column="NumberOfLegs" />
<return-property name="OfficialId" column="OfficialId" />
<return-property name="OptionStrikePrice" column="OptionStrikePrice" />
<return-property name="QtyDec" column="QtyDec" />
<return-property name="QtyMax" column="QtyMax" />
<return-property name="QtyMin" column="QtyMin" />
<return-property name="QtyMinAggr" column="QtyMinAggr" />
<return-property name="QtyMinFAS" column="QtyMinFAS" />
<return-property name="QtyNominal" column="QtyNominal" />
<return-property name="QtyTick" column="QtyTick" />
<return-property name="QuoteQtyTick" column="QuoteQtyTick" />
<return-property name="QuotingSide" column="QuotingSide" />
<return-property name="SecurityType" column="SecurityType" />
<return-property name="StrategyType" column="StrategyType" />
<return-property name="Segment" column="Segment" />
<return-property name="SubMarket" column="SubMarket" />
<return-property name="ValueDec" column="ValueDec" />
<return-property name="ValueFmt" column="ValueFmt" />
<return-property name="ValueMax" column="ValueMax" />
<return-property name="ValueMin" column="ValueMin" />
<return-property name="ValueTick" column="ValueTick" />
<return-property name="ValueType" column="ValueType" />
<return-property name="ApplicationId" column="ApplicationId" />
</return>
exec Espada.dbo.p_GetInstrumentsByIdRak :appId
</sql-query>

</hibernate-mapping>


I can select fine
IList<TestInstrument> list = PersistenceManager.RetrieveAll<TestInstrument>()

However using the Stored Proc I get an exception -
at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName)
at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
at NHibernate.Driver.NHybridDataReader.GetOrdinal(String name)
at NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name)
at NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String[] names, ISessionImplementor session, Object owner)
at NHibernate.Type.AbstractType.Hydrate(IDataReader rs, String[] names, ISessionImplementor session, Object owner)
at NHibernate.Type.ComponentType.Hydrate(IDataReader rs, String[] names, ISessionImplementor session, Object owner)
at NHibernate.Type.ComponentType.NullSafeGet(IDataReader rs, String[] names, ISessionImplementor session, Object owner)
at NHibernate.Loader.Loader.GetKeyFromResultSet(Int32 i, ILoadable persister, Object id, IDataReader rs, ISessionImplementor session)
at NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet,

with Message = "Id3_0_"

Has anyone seen this, or knows what cuases it or how to fix this?

thanks


Top
 Profile  
 
 Post subject: Re: Problem with Stored Procedures...
PostPosted: Thu Aug 13, 2009 5:24 am 
Newbie

Joined: Wed Jun 17, 2009 9:01 am
Posts: 1
Hi Rakesh,

I have identified few points in your hbm file...

One of the the thing is you are not specifying any class loader ref like this:
<loader query-ref="C_CLD_FCLD_NHIB_TEST_PROC"/>
</class>

For more info view this below link:

viewtopic.php?f=25&t=996257&p=2410363&hilit=How+to+execute+Stored+Procedure+with+NHibernate+Working+Sample+Code#p2410363


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.