manytomany

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;
}
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值