ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Celaya, Tina \(GE Indust, ConsInd\)" <tina.cel...@ge.com>
Subject RE: stored procedures
Date Wed, 23 Aug 2006 14:12:50 GMT
This is my class SalesMX. i´ll try doing what you told me about changing int for Interger
and double to Double... 
package Classes;
 
public class SalesMX {
 
    private int anio;
    private int mes;
    private String transaccion;
    private String documento;
    private String cliente;
    private String fecha;
    private String vencimiento;
    private String producto;
    private float cantidad;
    private float precio_unitario;
    private float subtotal;
    private float iva;
    private String fecha_pago;
    private float pago;
    private String moneda;
    private float tipocambio;
    private String transaccion_re;
    private String documento_ref;
    private String vendedor;
    private float basecomision;
    private float provision;
    private float iva_provision;
    private String sales_order;
    private String po;
    private float retencion_iva;
    private String oracle_tipo_transaccion;
    private float total_venta;
    private String nombre_producto;
    private String codigo_ibs;
    private String fabricacion;
    private String pg;
    private String pg1;
    private String pg2;
    private String pl;
    private String tipo;
    private String linea_financiera;
    private String watts;
    private String volts;
    private String bulb;
    private String margen;
    private String oracle_tipo_sku;
    private float custom_int;
    private float tax;
    private float freight_int;
    private float material;
    private float freight_ex;
    private float expenses;
    private float labor;
    private float custom_ext;
    private float coststd;
    private float conversion;
    private String nombre_cliente;
    private String nacional;
    private String geco;
    private String pais;
    private String cadena;
    private String numero_ibs;
    private String canal;
    private String nombre_vendedor;
    private String manager;
    private float picklist;
    private float programacion;
    private float distribucion;
    private float sininv;
    private float credithold;
    private float entered;
    private float cantidad_so;
    private String estatus;
    private String so_moneda;
    private float so_valor;
 
    public int getAnio() {
        return anio;
    }
 
    public float getBasecomision() {
        return basecomision;
    }
 
    public String getBulb() {
        return bulb;
    }
 
    public String getCadena() {
        return cadena;
    }
 
    public String getCanal() {
        return canal;
    }
 
    public float getCantidad() {
        return cantidad;
    }
 
    public float getCantidad_so() {
        return cantidad_so;
    }
 
    public String getCliente() {
        return cliente;
    }
 
    public String getCodigo_ibs() {
        return codigo_ibs;
    }
 
    public float getConversion() {
        return conversion;
    }
 
    public float getCoststd() {
        return coststd;
    }
 
    public float getCredithold() {
        return credithold;
    }
 
    public float getCustom_ext() {
        return custom_ext;
    }
 
    public float getCustom_int() {
        return custom_int;
    }
 
    public float getDistribucion() {
        return distribucion;
    }
 
    public String getDocumento() {
        return documento;
    }
 
    public String getDocumento_ref() {
        return documento_ref;
    }
 
    public String getEstatus() {
        return estatus;
    }
 
    public float getExpenses() {
        return expenses;
    }
 
    public String getFecha() {
        return fecha;
    }
 
    public String getFabricacion() {
        return fabricacion;
    }
 
    public String getFecha_pago() {
        return fecha_pago;
    }
 
    public float getFreight_ex() {
        return freight_ex;
    }
 
    public float getFreight_int() {
        return freight_int;
    }
 
    public String getGeco() {
        return geco;
    }
 
    public float getIva() {
        return iva;
    }
 
    public float getIva_provision() {
        return iva_provision;
    }
 
    public float getLabor() {
        return labor;
    }
 
    public String getLinea_financiera() {
        return linea_financiera;
    }
 
    public String getManager() {
        return manager;
    }
 
    public String getMargen() {
        return margen;
    }
 
    public float getMaterial() {
        return material;
    }
 
    public int getMes() {
        return mes;
    }
 
    public String getMoneda() {
        return moneda;
    }
 
    public String getNacional() {
        return nacional;
    }
 
    public String getNombre_cliente() {
        return nombre_cliente;
    }
 
    public String getNombre_producto() {
        return nombre_producto;
    }
 
    public String getNombre_vendedor() {
        return nombre_vendedor;
    }
 
    public String getNumero_ibs() {
        return numero_ibs;
    }
 
    public String getOracle_tipo_sku() {
        return oracle_tipo_sku;
    }
 
    public String getOracle_tipo_transaccion() {
        return oracle_tipo_transaccion;
    }
 
    public float getPago() {
        return pago;
    }
 
    public String getPais() {
        return pais;
    }
 
    public String getPg() {
        return pg;
    }
 
    public String getPg1() {
        return pg1;
    }
 
    public String getPg2() {
        return pg2;
    }
 
    public float getPicklist() {
        return picklist;
    }
 
    public String getPl() {
        return pl;
    }
 
    public float getPrecio_unitario() {
        return precio_unitario;
    }
 
    public String getPo() {
        return po;
    }
 
    public String getProducto() {
        return producto;
    }
 
    public float getProgramacion() {
        return programacion;
    }
 
    public float getProvision() {
        return provision;
    }
 
    public float getRetencion_iva() {
        return retencion_iva;
    }
 
    public String getSales_order() {
        return sales_order;
    }
 
    public float getSininv() {
        return sininv;
    }
 
    public String getSo_moneda() {
        return so_moneda;
    }
 
    public float getSo_valor() {
        return so_valor;
    }
 
    public float getSubtotal() {
        return subtotal;
    }
 
    public float getTax() {
        return tax;
    }
 
    public String getTipo() {
        return tipo;
    }
 
    public float getTipocambio() {
        return tipocambio;
    }
 
    public float getTotal_venta() {
        return total_venta;
    }
 
    public String getTransaccion() {
        return transaccion;
    }
 
    public String getTransaccion_re() {
        return transaccion_re;
    }
 
    public String getVencimiento() {
        return vencimiento;
    }
 
    public String getVendedor() {
        return vendedor;
    }
 
    public String getVolts() {
        return volts;
    }
 
    public String getWatts() {
        return watts;
    }
 
    public float getEntered() {
        return entered;
    }
 
    public void setAnio(int anio) {
        this.anio = anio;
    }
 
    public void setBasecomision(float basecomision) {
        this.basecomision = basecomision;
    }
 
    public void setBulb(String bulb) {
        this.bulb = bulb;
    }
 
    public void setCadena(String cadena) {
        this.cadena = cadena;
    }
 
    public void setCanal(String canal) {
        this.canal = canal;
    }
 
    public void setCantidad(float cantidad) {
        this.cantidad = cantidad;
    }
 
    public void setCantidad_so(float cantidad_so) {
        this.cantidad_so = cantidad_so;
    }
 
    public void setIva_provision(float iva_provision) {
        this.iva_provision = iva_provision;
    }
 
    public void setIva(float iva) {
        this.iva = iva;
    }
 
    public void setGeco(String geco) {
        this.geco = geco;
    }
 
    public void setFreight_int(float freight_int) {
        this.freight_int = freight_int;
    }
 
    public void setFreight_ex(float freight_ex) {
        this.freight_ex = freight_ex;
    }
 
    public void setFecha_pago(String fecha_pago) {
        this.fecha_pago = fecha_pago;
    }
 
    public void setFecha(String fecha) {
        this.fecha = fecha;
    }
 
    public void setFabricacion(String fabricacion) {
        this.fabricacion = fabricacion;
    }
 
    public void setExpenses(float expenses) {
        this.expenses = expenses;
    }
 
    public void setEstatus(String estatus) {
        this.estatus = estatus;
    }
 
    public void setDocumento_ref(String documento_ref) {
        this.documento_ref = documento_ref;
    }
 
    public void setDocumento(String documento) {
        this.documento = documento;
    }
 
    public void setDistribucion(float distribucion) {
        this.distribucion = distribucion;
    }
 
    public void setCustom_ext(float custom_ext) {
        this.custom_ext = custom_ext;
    }
 
    public void setCredithold(float credithold) {
        this.credithold = credithold;
    }
 
    public void setConversion(float conversion) {
        this.conversion = conversion;
    }
 
    public void setCodigo_ibs(String codigo_ibs) {
        this.codigo_ibs = codigo_ibs;
    }
 
    public void setCliente(String cliente) {
        this.cliente = cliente;
    }
 
    public void setLabor(float labor) {
        this.labor = labor;
    }
 
    public void setLinea_financiera(String linea_financiera) {
        this.linea_financiera = linea_financiera;
    }
 
    public void setMargen(String margen) {
        this.margen = margen;
    }
 
    public void setManager(String manager) {
        this.manager = manager;
    }
 
    public void setMaterial(float material) {
        this.material = material;
    }
 
    public void setMes(int mes) {
        this.mes = mes;
    }
 
    public void setMoneda(String moneda) {
        this.moneda = moneda;
    }
 
    public void setNacional(String nacional) {
        this.nacional = nacional;
    }
 
    public void setNombre_producto(String nombre_producto) {
        this.nombre_producto = nombre_producto;
    }
 
    public void setNumero_ibs(String numero_ibs) {
        this.numero_ibs = numero_ibs;
    }
 
    public void setOracle_tipo_sku(String oracle_tipo_sku) {
        this.oracle_tipo_sku = oracle_tipo_sku;
    }
 
    public void setOracle_tipo_transaccion(String oracle_tipo_transaccion) {
        this.oracle_tipo_transaccion = oracle_tipo_transaccion;
    }
 
    public void setPago(float pago) {
        this.pago = pago;
    }
 
    public void setPais(String pais) {
        this.pais = pais;
    }
 
    public void setPg(String pg) {
        this.pg = pg;
    }
 
    public void setPg1(String pg1) {
        this.pg1 = pg1;
    }
 
    public void setPg2(String pg2) {
        this.pg2 = pg2;
    }
 
    public void setPicklist(float picklist) {
        this.picklist = picklist;
    }
 
    public void setPl(String pl) {
        this.pl = pl;
    }
 
    public void setPo(String po) {
        this.po = po;
    }
 
    public void setPrecio_unitario(float precio_unitario) {
        this.precio_unitario = precio_unitario;
    }
 
    public void setProducto(String producto) {
        this.producto = producto;
    }
 
    public void setProgramacion(float programacion) {
        this.programacion = programacion;
    }
 
    public void setProvision(float provision) {
        this.provision = provision;
    }
 
    public void setSales_order(String sales_order) {
        this.sales_order = sales_order;
    }
 
    public void setSo_moneda(String so_moneda) {
        this.so_moneda = so_moneda;
    }
 
    public void setSo_valor(float so_valor) {
        this.so_valor = so_valor;
    }
 
    public void setSubtotal(float subtotal) {
        this.subtotal = subtotal;
    }
 
    public void setTipo(String tipo) {
        this.tipo = tipo;
    }
 
    public void setTipocambio(float tipocambio) {
        this.tipocambio = tipocambio;
    }
 
    public void setTotal_venta(float total_venta) {
        this.total_venta = total_venta;
    }
 
    public void setTransaccion(String transaccion) {
        this.transaccion = transaccion;
    }
 
    public void setTransaccion_re(String transaccion_re) {
        this.transaccion_re = transaccion_re;
    }
 
    public void setVencimiento(String vencimiento) {
        this.vencimiento = vencimiento;
    }
 
    public void setVendedor(String vendedor) {
        this.vendedor = vendedor;
    }
 
    public void setVolts(String volts) {
        this.volts = volts;
    }
 
    public void setWatts(String watts) {
        this.watts = watts;
    }
 
    public void setNombre_cliente(String nombre_cliente) {
        this.nombre_cliente = nombre_cliente;
    }
 
    public void setNombre_vendedor(String nombre_vendedor) {
        this.nombre_vendedor = nombre_vendedor;
    }
 
    public void setCoststd(float coststd) {
        this.coststd = coststd;
    }
 
    public void setCustom_int(float custom_int) {
        this.custom_int = custom_int;
    }
 
    public void setRetencion_iva(float retencion_iva) {
        this.retencion_iva = retencion_iva;
    }
 
    public void setSininv(float sininv) {
        this.sininv = sininv;
    }
 
    public void setTax(float tax) {
        this.tax = tax;
    }
 
    public void setEntered(float entered) {
        this.entered = entered;
    }
 
}
 
this is what i have in my xml
 
<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="vendedor" column="vendedor"/>
    <result property="basecomision" column="basecomision"/>
    <result property="provision" column="privision"/>
    <result property="iva_provision" column="iva_provision"/>
    <result property="sales_order" column="sales_order"/>
    <result property="po" column="po"/>
    <result property="retencion_iva" column="retencion_iva"/>
    <result property="oracle_tipo_transaccion" column="Oracle_tipo_transaccion"/>
    <result property="total_venta" column="total_venta"/>
    <result property="nombre_producto" column="nombre_producto"/>
    <result property="codigo_ibs" column="codigo_ibs"/>
    <result property="fabricacion" column="fabricacion"/>
    <result property="pg" column="pg"/>
    <result property="pg1" column="pg1"/>
    <result property="pg2" column="pg2"/>
    <result property="pl" column="pl"/>
    <result property="tipo" column="tipo"/>
    <result property="linea_financiera" column="linea_financiera"/>
    <result property="watts" column="watts"/>
    <result property="volts" column="volts"/>
    <result property="bulb" column="bulb"/>
    <result property="margen" column="margen"/>
    <result property="oracle_tipo_sku" column="oracle_tipo_sku"/>
    <result property="custom_int" column="custom_int"/>
    <result property="tax" column="tax"/>
    <result property="freight_int" column="freight_int"/>
    <result property="material" column="material"/>
    <result property="freight_ex" column="fregiht_ex"/>
    <result property="expenses" column="expenses"/>
    <result property="labor" column="labor"/>
    <result property="custom_ext" column="custom_ext"/>
    <result property="coststd" column="costostd"/>
    <result property="conversion" column="conversion"/>
    <result property="nombre_cliente" column="nombre_cliente"/>
    <result property="nacional" column="nacional"/>
    <result property="geco" column="GECO"/>
    <result property="pais" column="Pais"/>
    <result property="cadena" column="cadena"/>
    <result property="numero_ibs" column="numero_ibs"/>
    <result property="canal" column="canal"/>
    <result property="nombre_vendedor" column="nombre_vendedor"/>
    <result property="manager" column="manager"/>
    <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"/>
    <result property="so_moneda" column="so_moneda"/>
    <result property="so_valor" column="so_valor"/>
  </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>
 
And this is what i have in the action
 
 int id = form.getId();
            String descripcion = form.getDescripcion();
            int salida = form.getTipoSalida();
            HashMap hm = new HashMap();
            hm.put("id",new Integer(id));
            List reg=d.getList("salesReportDetail",hm);
            servletRequest.getSession().setAttribute("descripcion",descripcion);
            servletRequest.getSession().setAttribute("salida",new Integer(salida));
            servletRequest.getSession().setAttribute("registros",reg);
            return actionMapping.findForward("Exito");
 
I want to iterate registros in my jsp with struts and display de properties for example reg.anio,
reg.mes, reg.transaccion, etc...
thanks for your time and help
Tina



-----Original Message-----
From: Mkhitaryan, Aram [mailto:Aram.Mkhitaryan@lycos-europe.com]
Sent: Martes, 22 de Agosto de 2006 11:47 p.m.
To: user-java@ibatis.apache.org
Subject: RE: stored procedures



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