简体   繁体   English

oracle.jbo.domain.Number和java.lang.Number的区别

[英]Difference of oracle.jbo.domain.Number and java.lang.Number

I'm re-learning Java to work on an OAF (Oracle Application Framework) Page and I'm getting an error below due to a line in my code: 我正在重新学习Java以处理OAF(Oracle应用程序框架)页面,并且由于我的代码中有一行,我在下面收到错误:

Code Line 代码行

Number attrValue = (Number)currRow.getAttribute("IctTrxHdrId");

Error Message 错误信息

oracle.apps.fnd.framework.OAException: java.lang.ClassCastException: oracle.jbo.domain.Number oracle.apps.fnd.framework.OAException:java.lang.ClassCastException:oracle.jbo.domain.Number

I was able to resolve this taking the advice from a post in Oracle Forums that i should import oracle.jbo.domain.Number so that attrValue will use the oracle.jbo.domain.Number class instead of java.lang.Number . 我能够从Oracle论坛的帖子中获取建议,我应该导入oracle.jbo.domain.Number以便attrValue将使用oracle.jbo.domain.Number类而不是java.lang.Number

Also read from another post on SO that I can use the below syntax to use oracle.jbo.domain.Number : 另请阅读SO上的另一篇文章 ,我可以使用以下语法来使用oracle.jbo.domain.Number

oracle.jbo.domain.Number attrValue = (oracle.jbo.domain.Number) currRow.getAttribute("IctTrxHdrId");

I'm curious, What's the difference between the two classes? 我很好奇,两个班级有什么区别?

The class oracle.jbo.domain.Number is a wrapper around the class java.lang.Number . oracle.jbo.domain.Number是类java.lang.Number的包装器。

The goal is to have a domain object in the sense of the Oracle Fusion Middleware . 目标是在Oracle融合中间件的意义上拥有一个域对象。

From the 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. oracle.jbo.domain。*类,也称为“JBO Generic Domains”,为本机Java数据类型提供轻量级包装,例如java.lang.Number和java.sql.Date。 These wrappers allow the native Java datatypes to be represented as domain objects. 这些包装器允许将本机Java数据类型表示为域对象。 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. 域是标量数据值的类,可以以与层无关的方式访问,并且对数据库列的可映射性没有固有的含义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM