I have a problem with IntegerCache : Using the iBatis data access infrastructure that internally uses the iBatis PreparedStatement class.
A database procedure call, for example
{ call UPDATE_PROC(?,?,?,?,?,?) }
with params : [123, 234, 345, TEST1, 567, TEST2]
while the iBatis API sets the first parameter using:
typeHandler.setParameter(ps, i + 1, value, mapping.getJdbcTypeName());
i = 0, value = 123
here ps refers to PreparedStatement, i am the index of the parameter in the database procedure.
he internally calls
ps.setInt(i, ((Integer) parameter).intValue());
i = 1, parameter = 123 (Note: I am int not Integer)
Internal call invoked using reflection Java api:
public Object invoke(Object proxy, Method method, Object[] params) throws Throwable
method: setInt, params: [1, 123]
getting the Integer value i for the method call, the JVM is called below the method:
public static Integer valueOf(int i) {
assert IntegerCache.high >= 127;
if (i >= IntegerCache.low && i <= IntegerCache.high)
return IntegerCache.cache[i + (-IntegerCache.low)];
return new Integer(i);
}
IntegerCache.low = -128 IntegerCache.high = 127
IntegerCache.cache[i + (-IntegerCache.low)] IntegerCache.cache[129] 1 [129], , 3 [129]:
, -8, -7, -6, -5, -4, -3, -2, -1, 0, 3 **index[129]**, 2, 3 **index[131]**, 4, 5, 6, 7, 8, 9, 10, 11
IntegerCache , , . 3 [129] [131]
:
java.sql.SQLException: Missing IN or OUT parameter at index:: 1
, ?
,