我正在重新学习 Java 以在 OAF(Oracle 应用程序框架)页面上工作,由于代码中的一行,我收到以下错误:
代码行
Number attrValue = (Number)currRow.getAttribute("IctTrxHdrId");
错误消息
oracle.apps.fnd.framework.OAException: java.lang.ClassCastException: oracle.jbo.domain.Number
我根据Oracle Forums中的帖子的建议解决了这个问题。我应该导入 oracle.jbo.domain.Number
以便 attrValue
将使用 oracle.jbo.domain.Number
类而不是 java.lang.Number
。
另请阅读 another post on SO我可以使用以下语法来使用oracle.jbo.domain.Number
:
oracle.jbo.domain.Number attrValue = (oracle.jbo.domain.Number) currRow.getAttribute("IctTrxHdrId");
我很好奇,这两个类有什么区别?
最佳答案
类(class)oracle.jbo.domain.Number
是类的包装 java.lang.Number
.
目标是拥有 Oracle Fusion Middleware 意义上的域对象.
来自documentation :
The oracle.jbo.domain.* classes, also known as the "JBO Generic Domains", provide lightweight wrappers for the native Java data types, such as java.lang.Number and java.sql.Date. These wrappers allow the native Java datatypes to be represented as domain objects. A domain is a class for scalar data values that can be accessed in a tier-independent manner, and that has no inherent implication on mappability to database columns.
关于java - oracle.jbo.domain.Number 和 java.lang.Number 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42320259/