This content has been marked as final.
Show 1 reply
-
1. Re: Entity Bean serialization fails in cluster
marius.oancea Mar 5, 2009 9:31 AM (in response to marius.oancea)Problem was solved.
currentUser : user : groups[0] : users[0] : ... : attributes [0] : attributetemplate was lazy initialised and since the currentUser(of type UserDetails) was put on session, jboss was trying to serialise without having a hibernate session anymore.
Solution was:
Modify the class to make user and groups transient and serialize only their keys.
============================================================
public class UserDetails implements Serializable {
private Integer userId;
private Set<Integer> groupIds;
private User user;
private Set<Usergroup> groups;
...
public void getUser() {
if (user == null) { // that means this is user details first accessed after deserialization.
userService = Component.getInstance("userService");
user = userService.findUser(userId)
}
return userId;
}
}
================================================================
method getUser was modified to search for the user based on userId when it is not already initialised.