可调用语句双方法错误
我能够使用可调用语句将值设置为双精度,
this.setValue(new Double(cstmt.getDouble(4)));
但是当我尝试像这样写回它时,
cstmt.setDouble(4, this.getValue());
我收到错误..
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] cstmt.setDouble(7,this.getValue());
[exec] ^
任何建议可以用这个做什么
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] cstmt.setDouble(7,this.getValue());
[exec] ^
any suggestion what can be done with this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设
this.getValue()
返回一个Double
,看起来你需要使用this.getValue().doubleValue()
来匹配方法签名。它需要一个 double 基元,而不是 Double 对象。我猜您使用的是 Java 1.4 或更早版本。在 1.5 中,这个错误应该被自动装箱隐藏。
Assuming that
this.getValue()
returns aDouble
, it looks like you need to usethis.getValue().doubleValue()
to match the method signature. It takes adouble
primitive, not aDouble
object.I guess that you're using Java 1.4 or earlier. In 1.5 this error should have been hidden by autoboxing.
显然,以 cstmt 为实例的类没有名为 setDouble (int, java.lang.Double) 的(可见)成员函数。
是否有可能它应该是 setDouble (int, double) 并且您正在传递 java.lang.Double 的实例并且例程需要 double 类型的原语?
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?