package com.github.windbender.domain; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonIgnore; @Entity @Table(name="cameras") public class Camera implements Serializable { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name = "id", nullable=false) Long id; @JsonIgnore @ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name="project_id") Project project; @Column(name = "camera_name", nullable=false) String cameraName; public String getCameraName() { return cameraName; } public void setCameraName(String cameraName) { this.cameraName = cameraName; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Project getProject() { return project; } public void setProject(Project project) { this.project = project; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((cameraName == null) ? 0 : cameraName.hashCode()); result = prime * result + ((id == null) ? 0 : id.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; Camera other = (Camera) obj; if (cameraName == null) { if (other.cameraName != null) return false; } else if (!cameraName.equals(other.cameraName)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (project == null) { if (other.project != null) return false; } else if (!project.equals(other.project)) return false; return true; } @Override public String toString() { return "Camera [id=" + id + ", project=" + project + ", cameraName=" + cameraName + "]"; } }