'Getting Error related to number format (java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.String )

I am having a query as below

select SHIPMENT_COST_SEQNO as SHIPMENT_COST_SEQNO from shipment_cost where shipment_gid = 'A1.53005'

which gives me error as 'java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.String '

Though the SHIPMENT_COST_SEQNO is a 5 digit number but still gives me above error.

This works fine with SQL Interface but when i try execute from application it gives me above error .

Any pointers would be appreciable.

Thanks

sql


Solution 1:[1]

seems you need casting as your used in entity sting

select cast(SHIPMENT_COST_SEQNO as varchar(50))
 as SHIPMENT_COST_SEQNO from shipment_cost where shipment_gid = 'A1.53005'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Zaynul Abadin Tuhin