package com.sf.portal.teamInfo.model;
import java.util.HashSet;
import java.util.Set;
import com.google.common.base.Objects;
import javax.persistence.*;
@Entity
@Table(name = "SFRLF_TEAM_INFO")
public class TeamInfo {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "TN_TEAM_ID")
private long id;
@Lob
@Basic(fetch = FetchType.LAZY)
@Column(name = "TN_TEAM_LOGO")
private byte[] logo;
@Column(name = "TN_TEAM_NAME")
private String name;
@Column(name = "TN_TEAM_MOBILE")
private String mobile;
@Column(name = "TN_TEAM_NUMBER")
private Long number;
@Column(name = "TN_TEAM_KEYWORD")
private String keyword;
@Column(name = "TN_TEAM_REMARK")
private String remark;
@ManyToMany(fetch=FetchType.EAGER,cascade = {CascadeType.ALL})
@JoinTable(name="SFRLF_TEAM_MEMBERS",
joinColumns={@JoinColumn(name="TM_TEAM_ID",referencedColumnName="TN_TEAM_ID")},
inverseJoinColumns={@JoinColumn(name="TM_USER_ID",referencedColumnName="UI_USER_ID")})
private Set<UserInfo> users = new HashSet<UserInfo>();
public long getId() {
return id;
}
public byte[] getLogo() {
return logo;
}
public void setLogo(byte[] logo) {
this.logo = logo;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public Long getNumber() {
return number;
}
public void setNumber(Long number) {
this.number = number;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public void setId(long id) {
this.id = id;
}
@Override
public String toString() {
return Objects.toStringHelper(this)
.add("id", id)
.add("name", name)
.add("mobile", mobile)
.add("number", number)
.add("keyword", keyword)
.add("remark", remark)
.toString();
}
public static class Builder {
private long id;
private String name;
private String mobile;
private Long number;
private String keyword;
private String remark;
public Builder withId(long id) {
this.id = id;
return this;
}
public Builder withName(String name) {
this.name = name;
return this;
}
public Builder withMobile(String mobile) {
this.mobile = mobile;
return this;
}
public Builder withNumber(Long number) {
this.number = number;
return this;
}
public Builder withKeyword(String keyword) {
this.keyword = keyword;
return this;
}
public Builder withRemark(String remark) {
this.remark = remark;
return this;
}
public TeamInfo build() {
TeamInfo info = new TeamInfo();
info.id = id;
info.name = name;
info.mobile = mobile;
info.number = number;
info.remark = remark;
info.keyword = keyword;
info.remark = remark;
return info;
}
}
public Set<UserInfo> getUsers() {
return users;
}
public void setUsers(Set<UserInfo> users) {
this.users = users;
}
}
import java.util.HashSet;
import java.util.Set;
import com.google.common.base.Objects;
import javax.persistence.*;
@Entity
@Table(name = "SFRLF_TEAM_INFO")
public class TeamInfo {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "TN_TEAM_ID")
private long id;
@Lob
@Basic(fetch = FetchType.LAZY)
@Column(name = "TN_TEAM_LOGO")
private byte[] logo;
@Column(name = "TN_TEAM_NAME")
private String name;
@Column(name = "TN_TEAM_MOBILE")
private String mobile;
@Column(name = "TN_TEAM_NUMBER")
private Long number;
@Column(name = "TN_TEAM_KEYWORD")
private String keyword;
@Column(name = "TN_TEAM_REMARK")
private String remark;
@ManyToMany(fetch=FetchType.EAGER,cascade = {CascadeType.ALL})
@JoinTable(name="SFRLF_TEAM_MEMBERS",
joinColumns={@JoinColumn(name="TM_TEAM_ID",referencedColumnName="TN_TEAM_ID")},
inverseJoinColumns={@JoinColumn(name="TM_USER_ID",referencedColumnName="UI_USER_ID")})
private Set<UserInfo> users = new HashSet<UserInfo>();
public long getId() {
return id;
}
public byte[] getLogo() {
return logo;
}
public void setLogo(byte[] logo) {
this.logo = logo;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public Long getNumber() {
return number;
}
public void setNumber(Long number) {
this.number = number;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public void setId(long id) {
this.id = id;
}
@Override
public String toString() {
return Objects.toStringHelper(this)
.add("id", id)
.add("name", name)
.add("mobile", mobile)
.add("number", number)
.add("keyword", keyword)
.add("remark", remark)
.toString();
}
public static class Builder {
private long id;
private String name;
private String mobile;
private Long number;
private String keyword;
private String remark;
public Builder withId(long id) {
this.id = id;
return this;
}
public Builder withName(String name) {
this.name = name;
return this;
}
public Builder withMobile(String mobile) {
this.mobile = mobile;
return this;
}
public Builder withNumber(Long number) {
this.number = number;
return this;
}
public Builder withKeyword(String keyword) {
this.keyword = keyword;
return this;
}
public Builder withRemark(String remark) {
this.remark = remark;
return this;
}
public TeamInfo build() {
TeamInfo info = new TeamInfo();
info.id = id;
info.name = name;
info.mobile = mobile;
info.number = number;
info.remark = remark;
info.keyword = keyword;
info.remark = remark;
return info;
}
}
public Set<UserInfo> getUsers() {
return users;
}
public void setUsers(Set<UserInfo> users) {
this.users = users;
}
}