开发者

Callable statement double method error

I was able to get value set as double like this using callable statement

this.setValue(new Double(cstmt.getDouble(4)));

but when I try to write it back like this

cstmt.setDouble(4, this.getValue());

i get error..

compile:
     [exec] com\jack\common\javabean\ExampleBean.java:262: cannot resolve symbol
     [exec] symbol  : method setDouble (int,java.lang.Double)
     [exec] location: interface java.sql.CallableStatement
     [exec]         开发者_StackOverflow中文版            cstmt.setDouble(7,this.getValue());
     [exec]                              ^

any suggestion what can be done with this


Assuming that this.getValue() returns a Double, it looks like you need to use this.getValue().doubleValue() to match the method signature. It takes a double primitive, not a Double object.

I guess that you're using Java 1.4 or earlier. In 1.5 this error should have been hidden by autoboxing.


Appearently the class of which cstmt is an instance, has no (visible) member function called setDouble (int, java.lang.Double). Is it possible that it should be setDouble (int, double) and you are passing an instance of java.lang.Double and the routine expects a primitive of type double?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜