I have a function that returns an Object
The toString() method shows that my object has two BigDecimal attributes. But I don’t know how to get them in the code ?

My function uses hibernate to get results from a query is :
public Object executeQuery(final String sql) {
final Query query = getSessionFactory().getCurrentSession().createSQLQuery(sql);
return query.list().get(0);
}
Thank you.
— Additional infos:
obj.getClass().getDeclaredFields(); // empty array []
obj.getClass().getName(); // [Ljava.lang.Object;
final BigDecimal b = (BigDecimal) obj[0]; //Compilation error: The type of the expression must be an array type but it resolved to Object
Judging from your comments, your Object is and Object array.
So you should first cast the result to an Object array:
Then, you should be able to access the first BigDecimal like that:
Probably, you want to add some exception handling.