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.  [ 1 post ] 
Author Message
 Post subject: how to call SELECT stored procedure?
PostPosted: Wed Sep 10, 2008 9:38 am 
Newbie

Joined: Tue Sep 09, 2008 10:09 am
Posts: 1
how to call SELECT stored procedure?


Hibernate version:
1.2 and 2.0

Mapping documents:

<?xml version=”1.0″ encoding=”utf-8″?>
<hibernate-mapping xmlns=”urn:nhibernate-mapping-2.2″>
<class name=”DataTransfer.VisitInformation_SP,DataTransfer” table=”`VISIT_INFORMATION`” lazy=”true”>
<id name=”VisitInfoId” column=”`visit_info_id`” type=”int”>
<generator class=”native” />
</id>
<property type=”string” not-null=”true” length=”4″ name=”le_fst_nm” column=”`le_fst_nm`” />
<property type=”string” not-null=”true” name=”le_mid_nm” column=”`le_mid_nm`” />
<property type=”string” not-null=”true” name=”le_last_nm” column=”`le_last_nm`” />
<property type=”string” not-null=”true” length=”4″ name=”visit_info_nm” column=”`visit_info_nm`” />

</class>
<sql-query name=”visit_information_le_visit_le_name”>
<return alias=”visit_information” class=”DataTransfer.VisitInformation,DataTransfer” />
exec GetVisitorInformationByVisitInfoID :visit_info_id
</sql-query>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

public IList VisitInformationByVisitInfoID_SP(int VisitId)
{
return _session.GetNamedQuery(”visit_information_le_visit_le_name:VisitId”);
}

i know the above query throws an error but still trying to understand


Name and version of the database you are using:

sql server 2005

The generated SQL (show_sql=true):

Stored-Proc
***********

CREATE PROCEDURE [dbo].[GetCustomerByFirstNameAndLastName]
@Firstname varchar(50),
@Lastname varchar(50)
AS
BEGIN

select * from Customer where Firstname=@Firstname And Lastname=@Lastname

END


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

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.