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 when execute Stored procedure
PostPosted: Wed Apr 04, 2007 11:10 pm 
Newbie

Joined: Tue Mar 13, 2007 1:01 am
Posts: 14
I use the following snippet in mapping file and execute SQL Server stored procedure, my app works well

<sql-query name="test">
<return-scalar type="Date" column="Date"></return-scalar>
exec getDate :userID
</sql-query>

When I want to get a list of data from SQL server with the following mapping file :

<sql-query name="test">
<return class="test" alias="t">
<return-property name="Date" column="Date"></return-property>
</return>
exec getDate :userID
</sql-query>

I got problem :
System.IndexOutOfRangeException :

Error... Tablename_1_0_0 .......

Please tell me How I can get the list of data from executing stored procedure in NHibernate.

Thanks in advance.

Regards,

pcphuc.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 8:04 am 
Newbie

Joined: Mon Jan 29, 2007 2:03 am
Posts: 11
Hi,

Couple of things:

1.) Make sure you have that column/property defined in your table(result set)/entity.
2.) Make sure the returned results columns are mapped 1:1 with your entity since your named-query returns the entity itself.

Either of those will produce the exception since Nh's engine won't have a way to map the result to your entity.

hth


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.