[jboss-user] [EJB/JBoss] - Re: JBoss 5 CR2 - Serialization error
chiradeep
do-not-reply at jboss.com
Fri Nov 21 11:43:36 EST 2008
User entity
| import java.io.Serializable;
| import java.util.ArrayList;
| import java.util.Date;
| import java.util.List;
|
| import javax.persistence.CascadeType;
| import javax.persistence.Column;
| import javax.persistence.Entity;
| import javax.persistence.FetchType;
| import javax.persistence.Id;
| import javax.persistence.JoinColumn;
| import javax.persistence.JoinTable;
| import javax.persistence.ManyToMany;
| import javax.persistence.ManyToOne;
| import javax.persistence.OrderBy;
| import javax.persistence.Table;
| import javax.persistence.Temporal;
| import javax.persistence.TemporalType;
|
| @Entity
| @Table(name = "USER")
| public class User implements Serializable{
|
| private static final long serialVersionUID = -8928287817601838878L;
| private String id;
| private String pwd;
| private String name;
| private String type;
| private boolean active;
| private List<Group> groups = new ArrayList<Group>(0);
| private SectionGroup sectionGroup;
| private Department dept;
|
| @Id
| @Column(name = "USER_ID")
| public String getId() {
| return this.id;
| }
|
| public void setId(String id) {
| this.id = id;
| }
|
| @Column(name = "PASSWORD")
| public String getPwd() {
| return this.pwd;
| }
|
| public void setPwd(String pwd) {
| this.pwd = pwd;
| }
|
| @Column(name = "USER_NAME")
| public String getName() {
| return this.name;
| }
|
| public void setName(String name) {
| this.name = name;
| }
|
| @Column(name = "USER_TYPE")
| public String getType() {
| return this.type;
| }
|
| public void setType(String type) {
| this.type = type;
| }
|
| @Column(name = "ACTIVE_IND")
| public boolean isActive() {
| return this.active;
| }
|
| public void setActive(boolean active) {
| this.active = active;
| }
|
| @ManyToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
| @OrderBy("code ASC")
| @JoinTable(name = "ROLEGROUP_XREF", joinColumns = @JoinColumn(name = "USER_ID", referencedColumnName = "USER_ID"), inverseJoinColumns = @JoinColumn(name = "ROLEGROUP_CODE", referencedColumnName = "ROLEGROUP_CODE"))
| public List<Group> getGroups() {
| return groups;
| }
|
| public void setGroups(List<Group> groups) {
| this.groups = groups;
| }
|
|
| @ManyToOne(fetch = FetchType.EAGER)
| @JoinColumn(name = "SECTION_GROUP_ID")
| public SectionGroup getSectionGroup() {
| return sectionGroup;
| }
|
|
| public void setSectionGroup(SectionGroup sectionGroup) {
| this.sectionGroup = sectionGroup;
| }
|
| @ManyToOne(fetch = FetchType.LAZY)
| @JoinColumn(name = "DEPT_ID")
| public Department getDepartment() {
| return this.dept;
| }
|
| public void setDepartment(Department dept) {
| this.dept = dept;
| }
|
| @Override
| public String toString() {
| return getClass().getName() + "[id=" + getId() + "]";
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4191341#4191341
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4191341
More information about the jboss-user
mailing list