java.math.BigDecimal cannot be cast to [Ljava.lang.Object;

List queryList = executeReadAllSQLQuery(queryString);
    for (Iterator i = queryList.iterator(); i.hasNext();) {
        Object values[] = (Object[]);
        FDetails pDetails = transform(values);
        values = null;

Error I am getting at line 3 : java.math.BigDecimal cannot be cast to [Ljava.lang.Object;

My transform function :

private FDetails transform(Object[] values) {
    FDetails Details = new FDetails();
    return BalanceDetails;

Please help me resolve these issue.


How about this code:

List<BigDecimal> queryList = executeReadAllSQLQuery(queryString);

FDetails details = new FDetails();
int i = 0;
details.setPb(queryList.get(i ++));
details.setPm(queryList.get(i ++));


Note: Calling fDList.add() inside of the loop is almost certainly wrong. The loop gets one value from the list but you want all five values from the list, create one instance of FDetails from those five values and add that single instance to fDList once

It's clear from error that your List queryList is in fact a list of BigDecimals. So this would be work

BigDecimal value = (BigDecimal);

but since it's not what you expect then executeReadAllSQLQuery returns wrong result

BTW for-each would look better anyway

for (Object obj : queryList) {

The below line is returning you a java.math.BigDecimal which you are trying to cast illegaly to Object[]. It seems yourqueryList is a List<java.math.BigDecimal>.; // is returning you a  java.math.BigDecimal

This works very fine!. Please try this

    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("amt", "1000");

    System.out.println("Amount is::"
            + new BigDecimal((String) map.get("amt")));

Need Your Help

Prevent redirect-loop in Javascript-function

javascript jquery redirect

I got one ressource which is available through two urls, for example: and

LaTeX package to do syntax highlighting of code in various languages

syntax latex package highlighting

I am looking for a LaTeX package that does syntax highlighting on code. For example, right now I use the verbatim block to write code:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.