package entity.files;
import entity.staff.Training;
import entity.system.Users;
import javax.persistence.*;
import java.util.Date;
/**
* Created by tloehr on 19.05.14.
*/
@Entity
@Table(name = "training2file")
public class Training2File {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, insertable = true, updatable = true)
private long id;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@Basic
@Column(name = "pit", nullable = false, insertable = true, updatable = true)
@Temporal(TemporalType.TIMESTAMP)
private Date pit;
public Date getPit() {
return pit;
}
public void setPit(Date pit) {
this.pit = pit;
}
@JoinColumn(name = "editor", referencedColumnName = "UKennung")
@ManyToOne
private Users editor;
@JoinColumn(name = "trainid", referencedColumnName = "id")
@ManyToOne
private Training training;
@JoinColumn(name = "fid", referencedColumnName = "OCFID")
@ManyToOne
private SYSFiles sysfile;
public Training2File() {
}
public Training2File(SYSFiles sysfile, Training training, Users editor, Date pit) {
this.sysfile = sysfile;
this.training = training;
this.editor = editor;
this.pit = pit;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Training2File that = (Training2File) o;
if (id != that.id) return false;
if (editor != null ? !editor.equals(that.editor) : that.editor != null) return false;
if (pit != null ? !pit.equals(that.pit) : that.pit != null) return false;
if (sysfile != null ? !sysfile.equals(that.sysfile) : that.sysfile != null) return false;
if (training != null ? !training.equals(that.training) : that.training != null) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (pit != null ? pit.hashCode() : 0);
result = 31 * result + (editor != null ? editor.hashCode() : 0);
result = 31 * result + (training != null ? training.hashCode() : 0);
result = 31 * result + (sysfile != null ? sysfile.hashCode() : 0);
return result;
}
}