ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mkhitaryan, Aram" <Aram.Mkhitar...@lycos-europe.com>
Subject RE: stored procedures
Date Wed, 23 Aug 2006 04:46:45 GMT
Do you have setters?

 

As I wrote in my previous reply, try specifying java and sql types in result map.

Also you can try to change “int”s to “Integer”s.

 

If you use jdk1.5, you will not have problems with your code and performance,

just use object wrappers for primitives instead of primitive types (Integer instead of int,
Byte instead of byte).

 

Best,

Aram

 

________________________________

From: Celaya, Tina (GE Indust, ConsInd) [mailto:tina.celaya@ge.com] 
Sent: Wednesday, August 23, 2006 12:50 AM
To: user-java@ibatis.apache.org
Cc: Christian.Poitras@ircm.qc.ca
Subject: RE: stored procedures

 

It is just a class, The only thing i have in SalesMX class is the variables and their getter
and setter methods, for example

 

private int anio;    

private int mes;

private String transaccion;

private String documento;    

 

 public int getAnio() {
        return anio;
    }

 

public int getMes() {
        return mes;
    }

 

public String getTransaccion() {
        return transaccion;
    }

 

public int getDocumento() {
        return documento;
    }

 

etc..

 

and the names of the variables match the names in "property" in the resultMap. The stored
procedure returns a table with same number of columns and names that i put in the resultMap
in "column" and te data type that return the stored prodecure match the type in the class
SalesMX, or that is why i try to do, and y want to receive a List of SalesMX object, to do
that i put this on the action

 

HashMap hm = new HashMap();
 hm.put("id",new Integer(id));
 List reg=d.getList("salesReportDetail",hm); 

 

So i can deisplay the properties of each object in the list on a web page with struts, selecting
the properties i want to display, for example anio, mes, docuemnto, etc..

 

 

 

	-----Original Message-----
	From: Poitras Christian [mailto:Christian.Poitras@ircm.qc.ca]
	Sent: Martes, 22 de Agosto de 2006 01:28 p.m.
	To: user-java@ibatis.apache.org
	Subject: RE: stored procedures

	I am not sure that the error will show the name of the property. Especially if it's a NestedSQLException
(I think iBatis will show property names only when validating the xml file against java classes,
not jdbc types).

	First, you should check these.

	 

	Is your SalesMX an abstract class or interface? This could also be a cause...

	Can you post your java class?

	 

	Christian

	 

	
________________________________


	From: Celaya, Tina (GE Indust, ConsInd) [mailto:tina.celaya@ge.com] 
	Sent: Tuesday, 22 August 2006 14:09
	To: user-java@ibatis.apache.org
	Subject: RE: stored procedures

	And in the action i have this 

	 

	 HashMap hm = new HashMap();
	 hm.put("id",new Integer(id));
	 List reg=d.getList("salesReportDetail",hm);

	I want to receive a List of SalesMX objects....

		-----Original Message-----
		From: Celaya, Tina (GE Indust, ConsInd) 
		Sent: Martes, 22 de Agosto de 2006 12:59 p.m.
		To: user-java@ibatis.apache.org
		Subject: RE: stored procedures

		In my class SalesMX i only have Strings an floats, but first i had in SalesMX a variable
declared as int, but de stored procedure returned a String, and the error told me specifically
the name of the property than did not match on the SalesMX class and i change it, and then
this error presented, but is not telling me the property that can not be set.... so i dont
know what it is, but i think that if it was a type error it would tell me type mismatched
error or something like that....

			-----Original Message-----
			From: Poitras Christian [mailto:Christian.Poitras@ircm.qc.ca]
			Sent: Martes, 22 de Agosto de 2006 12:47 p.m.
			To: user-java@ibatis.apache.org
			Subject: RE: stored procedures

			At first it seems to be an error when calling the insert. Maybe a String is set into a
Integer or something...

			Is there any List/Array in your SalesMX?

			 

			Christian

			 

			
________________________________


			From: Celaya, Tina (GE Indust, ConsInd) [mailto:tina.celaya@ge.com] 
			Sent: Tuesday, 22 August 2006 13:27
			To: user-java@ibatis.apache.org
			Cc: clinton.begin@gmail.com
			Subject: stored procedures

			I have this for my stored procedure

			 

			  <resultMap id="salesmxRM" class="Classes.SalesMX">
			    <result property="anio" column="ano"/>
			    <result property="mes" column="mes"/>
			    <result property="transaccion" column="transaccion"/>
			    <result property="documento" column="documento"/>
			    <result property="cliente" column="cliente"/>
			    <result property="fecha" column="fecha"/>
			    <result property="vencimiento" column="vencimiento"/>
			    <result property="producto" column="producto"/>
			    <result property="cantidad" column="cantidad"/>
			    <result property="precio_unitario" column="precio_unitario"/>
			    <result property="subtotal" column="subtotal"/>
			    <result property="iva" column="iva"/>
			    <result property="fecha_pago" column="fecha_pago"/>
			    <result property="pago" column="pago"/>
			    <result property="moneda" column="moneda"/>
			    <result property="tipocambio" column="tipocambio"/>
			    <result property="transaccion_re" column="transaccion_re"/>
			    <result property="documento_ref" column="documento_ref"/>
			    <result property="picklist" column="picklist"/>
			    <result property="programacion" column="programacion"/>
			    <result property="distribucion" column="distribucion"/>
			    <result property="sininv" column="sininv"/>
			    <result property="credithold" column="credithold"/>
			    <result property="entered" column="entered"/>     
			    <result property="cantidad_so" column="cantidad_so"/>
			    <result property="estatus" column="estatus"/>
			  </resultMap>

			 

			  <parameterMap id="salesMxMap" class="map">
			    <parameter property="id" jdbcType="INTEGER" javaType="java.lang.Integer" mode="IN"
/>
			  </parameterMap>

			 

			  <procedure id="salesReportDetail" parameterMap="salesMxMap" resultMap="salesmxRM">
			    {call ld..getExtractoSales(?)}
			  </procedure>

			 

			I have the class SalesMX that contains all the properties listed in the salesmxRM resultMap
with the getter and setter method for each one, but i´m getting this error

			 

			com.ibatis.common.jdbc.exception.NestedSQLException:   
			--- The error occurred in persistence/salesMX.xml.  
			--- The error occurred while applying a result map.  
			--- Check the SalesMX.salesmxRM.  
			--- The error happened while setting a property on the result object.  
			--- Cause: com.ibatis.common.exception.NestedRuntimeException: Error setting properties
of 'Classes.SalesMX@174aa60'.  Cause: java.lang.IllegalArgumentException

			 

			can anyone help me? i´m new at this, and im trying to call a procedure with ibatis in
different ways but i can get it to work.... i´m working with microsft sql so the parameterMap
OUT ORACLECURSOR does not work for me, and i tried to upgrade to 2.2.0 and i had the Can't
start a cloned connection while in manual transaction mode error, so i went back and tried
to do it with the resultMap and parameterMap but i need help with this setting a property
error

			Thanks

			Tina

Mime
View raw message