title: Getting Javassist types instead of actual Hibernate entity types
body: <p>I have stumbled upon a really annoying situation: I am using Hibernate &amp; Spring as backend for my app and it seems that in some cases, the entities that are in a relationship with a particular entity are not fetched as normal entity objects from the DB, but as Javassist types. E.g.:</p>
  
  <p>I have the Campaign entity with the following relationships:</p>
  
  <pre><code>@Entity
  @Table(name = "campaign")
  public class Campaign implements Serializable {
    [..]
    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(uniqueConstraints = @UniqueConstraint(columnNames = {
          "campaign_id", "dealer_id" }), name = "campaign_has_dealer", joinColumns = { @JoinColumn(name = "campaign_id", nullable = false) }, inverseJoinColumns = { @JoinColumn(name = "dealer_id", nullable = false) })
    private List&lt;Dealer&gt; dealers = new ArrayList&lt;Dealer&gt;();
  
  @ManyToMany
  // (fetch = FetchType.LAZY)
  @JoinTable(uniqueConstraints = @UniqueConstraint(columnNames = {
          "campaign_id", "sales_area_id" }), name = "campaign_has_sales_area", joinColumns = { @JoinColumn(name = "campaign_id", nullable = false) }, inverseJoinColumns = { @JoinColumn(name = "sales_area_id", nullable = false) })
  private List&lt;SalesArea&gt; salesAreas = new ArrayList&lt;SalesArea&gt;();
  }
  </code></pre>
  
  <p>Upon retrieving the salesAreas connected to this Campaign, I get a list of SalesArea_$$_javassist_56, while for the dealers, I get normal Hibernate entities. Since the client part is based on GWT, we use RequestFactory for retrieving stuff. I initially thought it was a problem with the proxies, locators and so on but I have set a breakpoint in the service where these are retrieved and they are Javassist objects directly after selecting them. It seems that even removing the FetchType.LAZY annotation (although definitely not a desirable solution), the same thing happens. This happened also with other types of relationships, not only @ManyToMany.</p>
  
  <p>We are using GWT 2.3, Spring 3, Hibernate 3.6.3 and JPA 2.0 for annotations. </p>
  
  <p>Any suggestions would be appreciated. </p>
  
  <p>Thanks in advance</p>