I use GWT and JPA for persistence. I have created a domain JPA enchanted classes, DAO's and RPC for communication between them. Everything works fine, through RPC the client sends the object to server but could not get response. Server cannot deserialize in a compatible way with the client side. So i cannot use the server callBack back to the client. The exception message is this:
The response could not be deserialized, com.google.gwt.user.client.rpc.SerializationException
Here's a sample code of one of my classes:
@Entity
@Table(name="course")
public class Course implements Serializable {
private static final long serialVersionUID = 1L;
private int courseId;
private String name;
private List<Group> groups;
private List<Module> modules;
public Course() {
}
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(unique=true, nullable=false)
public int getCourseId() {
return this.courseId;
}
public void setCourseId(int courseId) {
this.courseId = courseId;
}
@Column(nullable=false, length=100)
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
//bi-directional many-to-one association to Group
@OneToMany(mappedBy="course", fetch=FetchType.LAZY)
public List<Group> getGroups() {
return this.groups;
}
public void setGroups(List<Group> groups) {
this.groups = groups;
}
//bi-directional many-to-one association to Module
@OneToMany(mappedBy="course", fetch=FetchType.LAZY)
public List<Module> getModules() {
return this.modules;
}
public void setModules(List<Module> modules) {
this.modules = modules;
}
}
- If i remove the relationships it work's fine. This is done because collections like lists, set's e.t.c are converted into hibernate objects that cannot be handled by GWT client side.