You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Cyril <cy...@yahoo.fr> on 2006/02/09 17:21:57 UTC

Stored procedures and iBatis

Hi !

I'm auditing iBatis to decide if we choose this
technologie for our project, but I have quite some
difficulties to find good documentation about iBatis
and stored procedures.

My project chose to call stored procedures for every
query to the database, and I need to understand how
iBatis support this.

http://ibatisnet.sourceforge.net/DevGuide/ar01s03.html#d0e333
(chapter 3.2.2) only present a call to a procedure
which doesn't return any result.

I read other submission to this list with example, but
usually, I can't find what I want to do: call a stored
procedure returning a list of objects

For example, how iBatis handle a stored query which
return a list of Contacts (mapping + java code)?
Is this possible?
I read that usually, the stored procedure will return
a Map, but what is in this map?
Is there instances of the Contact objects? If so, we
must specify a mapping from the result of the
procedure to the object, but how?

Some procedures return multiple result set. Is the
proposition at
http://opensource2.atlassian.com/confluence/oss/display/IBATIS/Improved+Stored+Procedure+Support+Whiteboard
implemented?

Many thanks!
Cyril Gambis


	

	
		
___________________________________________________________________________ 
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
Téléchargez sur http://fr.messenger.yahoo.com

Re: Stored procedures and iBatis

Posted by Brandon Goodin <br...@gmail.com>.
I would recommend you read the ibatis documentation as it provides
answers to most of your quesitons. None of the whiteboard features
have been added yet.

Brandon

On 2/9/06, Cyril <cy...@yahoo.fr> wrote:
> Hi !
>
> I'm auditing iBatis to decide if we choose this
> technologie for our project, but I have quite some
> difficulties to find good documentation about iBatis
> and stored procedures.
>
> My project chose to call stored procedures for every
> query to the database, and I need to understand how
> iBatis support this.
>
> http://ibatisnet.sourceforge.net/DevGuide/ar01s03.html#d0e333
> (chapter 3.2.2) only present a call to a procedure
> which doesn't return any result.
>
> I read other submission to this list with example, but
> usually, I can't find what I want to do: call a stored
> procedure returning a list of objects
>
> For example, how iBatis handle a stored query which
> return a list of Contacts (mapping + java code)?
> Is this possible?
> I read that usually, the stored procedure will return
> a Map, but what is in this map?
> Is there instances of the Contact objects? If so, we
> must specify a mapping from the result of the
> procedure to the object, but how?
>
> Some procedures return multiple result set. Is the
> proposition at
> http://opensource2.atlassian.com/confluence/oss/display/IBATIS/Improved+Stored+Procedure+Support+Whiteboard
> implemented?
>
> Many thanks!
> Cyril Gambis
>
>
> 	
>
> 	
> 		
> ___________________________________________________________________________
> Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs
> exceptionnels pour appeler la France et l'international.
> Téléchargez sur http://fr.messenger.yahoo.com
>

RE: Stored procedures and iBatis

Posted by Cyril <cy...@yahoo.fr>.
Some more informations:

Is this solution correct for you? iBatis is intended
to be used this way?

<resultMap id="result-get-contacts" class="Contact" >
    <result property="contactId" column="ID" />
    <result property="contactName" column="NAME" />
    <result property="ContactAddress" column="ADDRESS"
/>
 </resultMap>

 <parameterMap id="params-get-contacts" class="map" >
       <parameter property="beginningOfName"
jdbcType="VARCHAR" mode="IN"/>
 </parameterMap>

<procedure id="getContactsByBeginningOfName"
parameterMap="params-get-contacts"
resultMap="result-get-contacts" >
        { ? = call getContactsByBeginningOfName(?) }
 </procedure>

Map paramMap = new HashMap();
paramMap.put("beginningOfName", "Smi");
List listOfContacts = (List)
sqlMap.queryForList("getContactsByBeginningOfName",
paramMap);

System.out.println(((Contact)
listOfContacts.get(0)).getName);


Cyril

--- Cyril <cy...@yahoo.fr> a écrit :

> Hi !
> 
> I'm auditing iBatis to decide if we choose this
> technologie for our project, but I have quite some
> difficulties to find good documentation about iBatis
> and stored procedures.
> 
> My project chose to call stored procedures for every
> query to the database, and I need to understand how
> iBatis support this.
> 
>
http://ibatisnet.sourceforge.net/DevGuide/ar01s03.html#d0e333
> (chapter 3.2.2) only present a call to a procedure
> which doesn't return any result.
> 
> I read other submission to this list with example,
> but
> usually, I can't find what I want to do: call a
> stored
> procedure returning a list of objects
> 
> For example, how iBatis handle a stored query which
> return a list of Contacts (mapping + java code)?
> Is this possible?
> I read that usually, the stored procedure will
> return
> a Map, but what is in this map?
> Is there instances of the Contact objects? If so, we
> must specify a mapping from the result of the
> procedure to the object, but how?
> 
> Some procedures return multiple result set. Is the
> proposition at
>
http://opensource2.atlassian.com/confluence/oss/display/IBATIS/Improved+Stored+Procedure+Support+Whiteboard
> implemented?
> 
> Many thanks!
> Cyril Gambis
> 
> 
> 	
> 
> 	
> 		
>
___________________________________________________________________________
> 
> Nouveau : téléphonez moins cher avec Yahoo!
> Messenger ! Découvez les tarifs exceptionnels pour
> appeler la France et l'international.
> Téléchargez sur http://fr.messenger.yahoo.com
> 



	

	
		
___________________________________________________________________________ 
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
Téléchargez sur http://fr.messenger.yahoo.com