2 * Copyright (C) 2016 - 2019 Free Software Foundation
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.jjobs.model.user.skills;
19 import org.mxchange.jjobs.model.skill.JobSkill;
20 import org.mxchange.jjobs.model.skill.Skillable;
21 import java.util.Date;
22 import javax.persistence.Basic;
23 import javax.persistence.CascadeType;
24 import javax.persistence.Column;
25 import javax.persistence.Entity;
26 import javax.persistence.GeneratedValue;
27 import javax.persistence.GenerationType;
28 import javax.persistence.Id;
29 import javax.persistence.JoinColumn;
30 import javax.persistence.OneToOne;
31 import javax.persistence.Table;
32 import javax.persistence.Temporal;
33 import javax.persistence.TemporalType;
34 import org.mxchange.jusercore.model.user.LoginUser;
35 import org.mxchange.jusercore.model.user.User;
38 * A POJO entity for user skills
40 * @author Roland Häder<roland@mxchange.org>
42 @Entity (name = "user_skills")
46 @SuppressWarnings ("PersistenceUnitPresent")
47 public class UserSkill implements SkillableUser {
52 private static final long serialVersionUID = 12_837_674_186_902L;
55 * Link to skills entity
57 @JoinColumn (name = "user_skill_id", referencedColumnName = "skill_id", nullable = false, updatable = false)
58 @OneToOne (cascade = CascadeType.REFRESH, optional = false, targetEntity = JobSkill.class)
59 private Skillable jobSkill;
64 @JoinColumn (name = "user_skill_user_id", referencedColumnName = "user_id", nullable = false, updatable = false)
65 @OneToOne (cascade = CascadeType.REFRESH, optional = false, targetEntity = LoginUser.class)
66 private User skillUser;
69 * When this entry has been created
71 @Basic (optional = false)
72 @Column (name = "user_skill_created", nullable = false, updatable = false)
73 @Temporal (TemporalType.TIMESTAMP)
74 private Date userSkillCreated;
77 * Id number (primary key)
80 @GeneratedValue (strategy = GenerationType.IDENTITY)
81 @Column (name = "user_skill_entry_id", nullable = false, updatable = false)
82 private Long userSkillId;
85 * When this entry has been updated
87 @Column (name = "user_skill_updated", insertable = false)
88 @Temporal (TemporalType.TIMESTAMP)
89 private Date userSkillUpdated;
92 public Skillable getJobSkill () {
97 public void setJobSkill (final Skillable jobSkill) {
98 this.jobSkill = jobSkill;
102 public User getSkillUser () {
103 return this.skillUser;
107 public void setSkillUser (final User skillUser) {
108 this.skillUser = skillUser;
112 @SuppressWarnings ("ReturnOfDateField")
113 public Date getUserSkillCreated () {
114 return this.userSkillCreated;
118 @SuppressWarnings ("AssignmentToDateFieldFromParameter")
119 public void setUserSkillCreated (final Date userSkillCreated) {
120 this.userSkillCreated = userSkillCreated;
124 public Long getUserSkillId () {
125 return this.userSkillId;
129 public void setUserSkillId (final Long userSkillId) {
130 this.userSkillId = userSkillId;
134 @SuppressWarnings ("ReturnOfDateField")
135 public Date getUserSkillUpdated () {
136 return this.userSkillUpdated;
140 @SuppressWarnings ("AssignmentToDateFieldFromParameter")
141 public void setUserSkillUpdated (final Date userSkillUpdated) {
142 this.userSkillUpdated = userSkillUpdated;