java.lang.ClassCastException: java.lang.Short

It(He,She) gives me the exception java.lang. ClassCastException: java.lang. Short, the complete code is:

java.lang.ClassCastException: java.lang.Short

inventBD.EquipoBD.ConsultarEquipo(EquipoBD.java:36)

In the line 36 what I have is:

nuevo_equipo.setPart((Integer)traRes.getObject(4));

The information that I spend(pass) this one to him(her) declared as an integer.

Which can be the problem? Something on having done the casting?

[473 byte] By [nenukaa] at [2007-10-3 2:28:09]
# 1

> It(He,She)

it

> gives me the exception java.lang.

> ClassCastException: java.lang. Short,

So what does the API say this means? Ever bothered to have a look?

> the complete

> code is:

>

> java.lang.ClassCastException: java.lang.Short

> inventBD.EquipoBD.ConsultarEquipo(EquipoBD.java:36)

> In the line 36 what I have is:

>

> nuevo_equipo.setPart((Integer)traRes.getObject(4));

>

> The information that I spend(pass) this one to

> him(her) declared as an integer.

You cast it to Integer. But it's a Short.

CeciNEstPasUnProgrammeura at 2007-7-14 19:27:13 > top of Java-index,Java Essentials,New To Java...
# 2

what?I do not understand you, to I have it declared as an integer, not as a short.

To that you refer that it(he,she) does? That it(he,she) puts:

Nuevo_equipo.setPart ((Short) otraRes.getObject (4));

I feel it, but it(he,she) is that I do not have a lot of experience in java.thank you

nenukaa at 2007-7-14 19:27:13 > top of Java-index,Java Essentials,New To Java...
# 3

> what?I do not understand you, to I have it declared

> as an integer, not as a short.

>> java.lang.ClassCastException: java.lang.Short

If it says it's a Short, then it's a Short. You sould look at the part where you put the stuff into the List, not at where you get it out of it.

> To that you refer that it(he,she) does?

it.

CeciNEstPasUnProgrammeura at 2007-7-14 19:27:13 > top of Java-index,Java Essentials,New To Java...