Conversion of types
I want to know a thing, when I have an information declared in a database as(like) int, when I use it in my application have a method to gather and give him(her) value as this one:
private static Integer codigo_eq;
codigo_eq=new Integer(0);
Public static void setCodigoeq (Integer value) {codigo_eq=valor;
}
Public static Integer getCodigoeq () {return codigo_eq;
}
And now I call it from another class hereby:
Nuevo_equipo.setCodigoeq ((Integer) otraRes.getObjec t (1));
To gather the value and a mistake goes out for me:
Java.lang. ClassCastException: java.lang. Long inventBD.EquipoBD.ConsultarEquipo (EquipoBD.java:33)
Can someone help me? That turning(becoming) mad this mistake!!!!!!!!!!! And already not as(like) putting it, thank you
[817 byte] By [
nenukaa] at [2007-10-3 3:01:03]

I do not deal very to that you refer, but to seeing if it can be this:
In the line 33 :
nuevo_equipo.setCodigoeq((Integer)otraRes.getObject(1));
And the mistake that gives is:
java.lang.ClassCastException: java.lang.Long
inventBD.EquipoBD.ConsultarEquipo(EquipoBD.java:33)
org.apache.jsp.inzamac2.consultareq_jsp._jspService(consultareq_jsp.java:95)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
You are casting something, the result of otraRes.getObject(1), to Integer. It's telling you it can't be done because it's a Long. Maybe you should cast to Long instead (and be using Longs instead of Integers all over).
Just because a type is called "INT" in your database, does not mean that it maps to a Java Integer.
Lokoa at 2007-7-14 20:50:43 >
