Java tutorial
/******************************************************************************* * Copyright 2015 InfinitiesSoft Solutions Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. You may obtain * a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. *******************************************************************************/ package com.infinities.skyport.entity; import static javax.persistence.GenerationType.IDENTITY; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; /** * RolePermission generated by hbm2java */ @Entity @Table(name = "ROLE_PERMISSION") @JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" }) public class RolePermission implements java.io.Serializable { private static final long serialVersionUID = 1L; private Long id; private Role role; private PermissionOperation permissionOperation; private String desc; public RolePermission() { } public RolePermission(Role role, PermissionOperation permissionOperation, String desc) { this.role = role; this.permissionOperation = permissionOperation; this.desc = desc; } @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "ID", unique = true, nullable = false) public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "ROLEID") public Role getRole() { return this.role; } public void setRole(Role role) { this.role = role; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "PERMISSIONID") public PermissionOperation getPermissionOperation() { return this.permissionOperation; } public void setPermissionOperation(PermissionOperation permissionOperation) { this.permissionOperation = permissionOperation; } @Column(name = "DESCRIPTION", length = 256) public String getDesc() { return this.desc; } public void setDesc(String desc) { this.desc = desc; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((desc == null) ? 0 : desc.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((permissionOperation == null) ? 0 : permissionOperation.hashCode()); result = prime * result + ((role == null) ? 0 : role.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } RolePermission other = (RolePermission) obj; if (desc == null) { if (other.desc != null) { return false; } } else if (!desc.equals(other.desc)) { return false; } if (id == null) { if (other.id != null) { return false; } } else if (!id.equals(other.id)) { return false; } if (permissionOperation == null) { if (other.permissionOperation != null) { return false; } } else if (!permissionOperation.equals(other.permissionOperation)) { return false; } if (role == null) { if (other.role != null) { return false; } } else if (!role.equals(other.role)) { return false; } return true; } }