How to get attributes of an Object in Java?
<p>I have a function that returns an <code>Object</code></p>

<p>The <code>toString()</code> method shows that my object has two <code>BigDecimal</code> attributes. But I don't know how to get them in the code ?</p>

<p><img src="http://i.stack.imgur.com/HR4TF.jpg" alt="enter image description here"></p>

<p>My function uses hibernate to get results from a query is :</p>

<pre><code>public Object executeQuery(final String sql) {
    final Query query = getSessionFactory().getCurrentSession().createSQLQuery(sql);
    return query.list().get(0);
}
</code></pre>

<p>Thank you.</p>

<p>-- Additional infos:</p>

<pre><code>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
</code></pre>
