I came across a really unpleasant situation: I use Hibernate and Spring as a backend for my application, and it seems that in some cases entities that are in a relationship with a specific object are not obtained as regular objects objects from the database, but as types of javassists. For instance:.
I have a Campaign object with the following relationships:
@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<Dealer> dealers = new ArrayList<Dealer>(); @ManyToMany
When I receive sales information related to this campaign, I get a list of SalesArea _ $$ _ javassist_56, while for dealers I get regular Hibernate objects. Since the client side is based on GWT, we use RequestFactory to retrieve the material. Initially, I thought it was a problem with proxies, locators, etc., but I set a breakpoint in the service where they are retrieved, and they are Javassist objects immediately after they are selected. It seems that even deleting the FetchType.LAZY annotation (although this is certainly not the desired solution), the same thing happens. This happened with other types of relationships, not just @ManyToMany.
We use GWT 2.3, Spring 3, Hibernate 3.6.3, and JPA 2.0 for annotations.
Any suggestions would be appreciated.
Thanks in advance
source share