-->
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.  [ 3 posts ] 
Author Message
 Post subject: Stored Procedures
PostPosted: Wed Nov 08, 2006 10:15 am 
Newbie

Joined: Wed Oct 11, 2006 11:32 am
Posts: 18
Hello,

I'm kind of new with hibernate and I'd like to use existing stored procedure from my database.

Looking in the kind of short hibernate documentation on the subject, it appears that it is necessary to specify the returned fields from the stored proc in a mapping file.
1. My first question is : Is it possible to specify several types of returns (like in the following example) ?

Code:
<sql-query name="selectAllEmployees_SP" callable="true">
    <return alias="pers" class="Person">
        <return-property name="name" column="NAME"/>
        <return-property name="age" column="AGE"/>
    </return>
    <return alias="emp" class="Employment">
        <return-property name="employee" column="EMPLOYEE"/>
        <return-property name="employer" column="EMPLOYER"/>
    </return>
    { ? = call selectAllEmployments() }
</sql-query>


2. The second question is : In which file should I define the mapping ?
3. The final question is : How do i call the stored proc in my java code ?

Many thanks :o)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 09, 2006 6:23 am 
Newbie

Joined: Wed Oct 11, 2006 11:32 am
Posts: 18
do you have any ideas on the subject ?

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 09, 2006 6:44 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
#1 yes (as per the docs)
#2 in your mapping files
#3 e.g. query.list() just as documented

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.