/******************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright (c) 2013,2014 by Peter Pilgrim, Addiscombe, Surrey, XeNoNiQUe UK * * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU GPL v3.0 * which accompanies this distribution, and is available at: * http://www.gnu.org/licenses/gpl-3.0.txt * * Developers: * Peter Pilgrim -- design, development and implementation * -- Blog: http://www.xenonique.co.uk/blog/ * -- Twitter: @peter_pilgrim * * Contributors: * *******************************************************************************/ package je7hb.basic4.jpa.onetomany; import javax.persistence.*; /** * The type Task * * @author Peter Pilgrim (peter) */ @Entity public class Task implements java.io.Serializable { @Id @Column(name="TASK_ID") @GeneratedValue(strategy = GenerationType.AUTO) private int id; @Column(nullable = false) private int position; private int length; private String title; private String description; public Task() { this(0,0,null,null); } public Task(int position, int length, String title, String description) { this.position = position; this.length = length; this.title = title; this.description = description; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getPosition() { return position; } public void setPosition(int position) { this.position = position; } public int getLength() { return length; } public void setLength(int length) { this.length = length; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Task)) return false; Task task = (Task) o; if (id != task.id) return false; if (length != task.length) return false; if (position != task.position) return false; if (description != null ? !description.equals(task.description) : task.description != null) return false; if (title != null ? !title.equals(task.title) : task.title != null) return false; return true; } @Override public int hashCode() { int result = id; result = 31 * result + position; result = 31 * result + length; result = 31 * result + (title != null ? title.hashCode() : 0); result = 31 * result + (description != null ? description.hashCode() : 0); return result; } @Override public String toString() { return "Task{" + "id=" + id + ", position=" + position + ", length=" + length + ", title='" + title + '\'' + ", description='" + description + '\'' + '}'; } }