Java.math.BigDecimal cannot is cast to java.lang.String----solution

Source: Internet
Author: User

Today in the development of a problem encountered, in this record, the problem is probably the meaning of the type is inconsistent can not be a strong turn

The code is as follows:

ROLF.SETFUNCD (String) rece.get ("FUN_CD");//strong Transfer Rolf.setfunid ((string) rece.get ("fun_id"); Strong Turn rolf.setfunnm (String) rece.get ("fun_nm"); Strong turn

Because my second paragraph of code the field type of the ORC database is number, and the entity type is string

So I was in the execution of the error, Java.math.BigDecimal cannot is cast to java.lang.String

Change the second piece of code to the following format. ToString () error is dismissed because:

ROLF.SETFUNCD (String) rece.get ("FUN_CD");//strong Turn Rolf.setfunid (Rece.get ("fun_id"). toString ()); The explanations are as follows ROLF.SETFUNNM (String) rece.get ("fun_nm"));
ToString is a method of the object class, and all classes inherit from the object class. If you define a class that does not overwrite the ToString method, the object uses the object class ToString method when calling the ToString method


This article is from the "Yipaixiaoyayin" blog, make sure to keep this source http://yipaixiaoyayin.blog.51cto.com/8812323/1910085

Java.math.BigDecimal cannot is cast to java.lang.String----solution

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.