struts2 spring2.5 jpa hibernate 权限管理系统源代码
源代码在线查看: 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;
}
}