You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Prospa <mp...@yahoo.com> on 2006/07/13 13:10:28 UTC
Error with dynamic sql and hastable
I sent multiple parameters via a hashtable to the BD
code:
Dim listeCdeAemettre As IList = New ArrayList()
Dim parameters As New Hashtable
parameters("listeRayon") = listeRayonAutorise
parameters("nomFournisseur") = "interforum"
parameters("codePorteFeuille") = "prtfl"
'parameters("Num") = 8
Try
listeCdeAemettre =
mappeurIbm5000.QueryForList("FindAllCdeAEmettre", parameters)
Return listeCdeAemettre
The problem is, until 3 parameter, everything is ok; when I add the 4th, I
have an exception
"The index was except limits. He was have to be negative and must be lower
than the size of the collection.
Name of the parameter: index"
This is the statement:
SELECT CDEAEMETTRE.NUM_EMETTRE, CDEAEMETTRE.CODE_PORTEFEUILLE,
CDEAEMETTRE.CODE_RAYON,
CDEAEMETTRE.GCD_FABRICANT, CDEAEMETTRE.NOM_FOURNISSEUR,
CDEAEMETTRE.QTE_ACOMMANDER,
CDEAEMETTRE.REM_BASE, CDEAEMETTRE.REM_EXCEPTION,
CDEAEMETTRE.PRIX_ACHAT_HT, CDEAEMETTRE.NOM_OPERATION,
CDEAEMETTRE.STATUT_CDE, STOCK.STOCK_RAYON, PRODUIT.LIB_PRODUIT,
PRODUIT.NOM_AUTEUR,
PRODUIT.NOM_EDITEUR, PRODUIT.NOM_COLLECTION,
FOURNISSEUR.TYPE_TRANSMISSION, STOCK_GROUPE.stock
FROM STOCK INNER JOIN
PRODUIT ON STOCK.GCD_FABRICANT = PRODUIT.GCD_FABRICANT INNER JOIN
CDEAEMETTRE ON STOCK.CODE_RAYON = CDEAEMETTRE.CODE_RAYON AND
STOCK.GCD_FABRICANT = CDEAEMETTRE.GCD_FABRICANT INNER JOIN
FOURNISSEUR ON CDEAEMETTRE.NOM_FOURNISSEUR = FOURNISSEUR.NOM_FOURNISSEUR
INNER JOIN
STOCK_GROUPE ON STOCK.GCD_FABRICANT = STOCK_GROUPE.GCD_FABRICANT_NEUF
CDEAEMETTRE.CODE_RAYON IN
#listeRayon[]#
CDEAEMETTRE.NOM_FOURNISSEUR = #nomFournisseur#
CDEAEMETTRE.CODE_PORTEFEUILLE = #codePorteFeuille#
CDEAEMETTRE.NUM_EMETTRE = #Num#
Doe's anyone has an idea? does the hashtable is limited to 3 items in
ibatis.net?
Regards
--
View this message in context: http://www.nabble.com/Error-with-dynamic-sql-and-hastable-tf1936564.html#a5305988
Sent from the iBATIS - User - Cs forum at Nabble.com.
Re: Error with dynamic sql and hastable
Posted by Prospa <mp...@yahoo.com>.
<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="CdeaemettreMap"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="SqlMap.xsd">
<alias>
<typeAlias alias="CdeAEmettre" assembly="GJCommon.dll"
type="GJCommon.vo.CdeAEmettreVO" />
</alias>
<resultMaps>
<resultMap id="CdeaemettreResult" class="CdeAEmettre">
<result property="NumEmettre" column="NUM_EMETTRE" type="int"
dbType="Int"/>
<result property="CodePortefeuille" column="CODE_PORTEFEUILLE"/>
<result property="CodeRayon" column="CODE_RAYON"/>
<result property="GcdFabricant" column="GCD_FABRICANT"/>
<result property="NomFournisseur" column="NOM_FOURNISSEUR"/>
<result property="QteAcommander" column="QTE_ACOMMANDER"/>
<result property="RemBase" column="REM_BASE"/>
<result property="RemException" column="REM_EXCEPTION"/>
<result property="PrixAchatHt" column="PRIX_ACHAT_HT"/>
<result property="NomOperation" column="NOM_OPERATION"/>
<result property="StatutCde" column="STATUT_CDE"/>
</resultMap>
</parameterMaps>
<statements>
<select id="FindCdeAEmettre" parameterClass="Hashtable"
resultClass="CdeAEmettre">
SELECT CDEAEMETTRE.NUM_EMETTRE, CDEAEMETTRE.CODE_PORTEFEUILLE,
CDEAEMETTRE.CODE_RAYON,
CDEAEMETTRE.GCD_FABRICANT, CDEAEMETTRE.NOM_FOURNISSEUR,
CDEAEMETTRE.QTE_ACOMMANDER,
CDEAEMETTRE.REM_BASE, CDEAEMETTRE.REM_EXCEPTION,
CDEAEMETTRE.PRIX_ACHAT_HT, CDEAEMETTRE.NOM_OPERATION,
CDEAEMETTRE.STATUT_CDE, STOCK.STOCK_RAYON, PRODUIT.LIB_PRODUIT,
PRODUIT.NOM_AUTEUR,
PRODUIT.NOM_EDITEUR, PRODUIT.NOM_COLLECTION,
FOURNISSEUR.TYPE_TRANSMISSION,
PRODUIT.GJ_CODEDISPONIBILITE
FROM STOCK INNER JOIN
PRODUIT ON STOCK.GCD_FABRICANT = PRODUIT.GCD_FABRICANT INNER JOIN
CDEAEMETTRE ON STOCK.CODE_RAYON = CDEAEMETTRE.CODE_RAYON AND
STOCK.GCD_FABRICANT = CDEAEMETTRE.GCD_FABRICANT INNER JOIN
FOURNISSEUR ON CDEAEMETTRE.NOM_FOURNISSEUR = FOURNISSEUR.NOM_FOURNISSEUR
<dynamic prepend="where">
<isParameterPresent>
<isNotEmpty prepend="and" property="nomFournisseur" >
CDEAEMETTRE.NOM_FOURNISSEUR = #nomFournisseur#
</isNotEmpty>
<isNotEmpty prepend="and" property="codePorteFeuille" >
CDEAEMETTRE.CODE_PORTEFEUILLE = #codePorteFeuille#
</isNotEmpty>
<isNotEmpty prepend="and" property="nomOperation" >
CDEAEMETTRE.NOM_OPERATION = #nomOperation#
</isNotEmpty>
<isNotEmpty prepend="and" property="listeRayon" >
CDEAEMETTRE.CODE_RAYON IN
<iterate open="(" close=")" conjunction=",">
#listeRayon[]#
</iterate>
</isNotEmpty>
<isNotEmpty prepend="and" property="Num" >
CDEAEMETTRE.NUM_EMETTRE = #Num#
</isNotEmpty>
</isParameterPresent>
</dynamic>
</select >
</statements>
</sqlMap>
Thanks
--
View this message in context: http://www.nabble.com/Error-with-dynamic-sql-and-hastable-tf1936564.html#a5309399
Sent from the iBATIS - User - Cs forum at Nabble.com.
Re: Error with dynamic sql and hastable
Posted by Prospa <mp...@yahoo.com>.
The error seems to come from the iterate statement: the statement works with
iterate until 3 parameters in my hashtable; above 3 params, I have an error;
and when I remove the iterate tag, it begins to work.
--
View this message in context: http://www.nabble.com/Error-with-dynamic-sql-and-hastable-tf1936564.html#a5309426
Sent from the iBATIS - User - Cs forum at Nabble.com.
Re: Error with dynamic sql and hastable
Posted by Gilles Bayon <ib...@gmail.com>.
Which version of iBATIS are you using ?
Can you post your sqlmap file ?
-Gilles