I'm getting the following error:
org.mozilla.javascript.EvaluatorException: Cannot convert id to
java.lang.Integer (server_bootstrap_030.Database.js#163)
at
org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:994)
....
inside the following script:
database.ps.setParameter = function (ps, sqlType, index, param) {
log.debug('Setting param, SQL Type: ' + sqlType + ', index: ' + index +
', type: ' + (typeof param) + ', value: ' + JSON.encode(param));
switch (sqlType) {
...
case java.sql.Types.INTEGER:
case java.sql.Types.SMALLINT:
ps.setInt(index, param); <-- Here is the error
break;
...
case java.sql.Types.CHAR:
case java.sql.Types.VARCHAR:
case java.sql.Types.LONGVARCHAR:
default:
ps.setString(index, param);
};
};
This is a function that I wrote to set parameters into a
java.sql.PreparedStatement but it is not working because I'm having this
problem converting 'param' that is a number to a java.lang.Integer, as
stated in the exception. The logging statement in the beginning of the
function outputs the following:
Setting param, SQL Type: 4, index: id, type: number, value: 32
Calling java methods with numbers worked in many different places, I don't
know why is not working here.
Any help would be appreciated.
Vinicius Isola
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino