📄 rolefunction.java
字号:
package sunyang.relationship.domain;
import javax.persistence.*;
import sunyang.functions.domain.Function;
import sunyang.role.domain.Role;
//把这个类实体化,并设置其对应表
@Entity
@Table(name = "role_function")
public class RoleFunction implements java.io.Serializable {
// 对应数据表字段的变量
private Integer id;
// 对应关联变量
private Role role;
private Function function;
// 空构造方法
public RoleFunction() {
}
// 设置变量id对应数据库表字段为id,且为主键,并设置其主键策略为SEQUENCE
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@Column(name = "id")
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
// 设置关联属性
@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
@JoinColumn(name = "roleid")
public Role getRole() {
return this.role;
}
public void setRole(Role role) {
this.role = role;
}
// 设置关联属性
@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
@JoinColumn(name = "functionid")
public Function getFunction() {
return function;
}
public void setFunction(Function function) {
this.function = function;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -