struts2 spring2.5 jpa hibernate 权限管理系统源代码

源代码在线查看: rolefunction.java

软件大小: 9052 K
上传用户: tzxiaojian
关键词: hibernate struts2 spring 2.5
下载地址: 免注册下载 普通下载 VIP

相关代码

				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;
					}
				
				}			

相关资源