Hibernate returns a proxy for an object set to EAGER
<p>We are working with a set of webservices we develop. </p>

<p>One of the services retrieves information from some tables using JPA mappings. Hibernate returns an object and it works as expected.</p>

<p>Other service retrieves a very similar object and it is returning a proxy instead of a read object. The fetch is set to EAGER so I really don't get why is this happening. We tried several ways to convert the proxy to real data (which I understand it is unnecessary as it is set to EAGER) but the proxy does not get converted.</p>

<p>We are working with hibernate 3.5.4-final in case it matters.</p>

<p>I really don't know where to start with, any hint?</p>

<pre><code>@Entity
public class Foo1
{
    @OneToMany(fetch = FetchType.EAGER, orphanRemoval = true, cascade = CascadeType.ALL)
    private List&lt;Foo2&gt; list = new ArrayList&lt;Foo2&gt;();
}

@Entity
public class Foo2
{
    @ManyToOne(fetch = FetchType.EAGER)
    private Foo3 obj;
}
</code></pre>

<p>To retrieve the data we call:</p>

<pre><code>entityManager.find(Foo1.class, id);       
</code></pre>

<p>One thought I had is that maybe Hibernate is having an internal exception managed and that's why I get a proxy instead of the real object?</p>

<p><strong>EDIT</strong>
This is the configuration of Hibernate related with the issue:</p>

<pre><code>&lt;property name="hibernate.max_fetch_depth" value="0"/&gt;
&lt;property name="hibernate.default_batch_fetch_size" value="16"/&gt;
&lt;property name="hibernate.jdbc.batch_size" value="16"/&gt;
</code></pre>