package uk.org.adamretter.webexample.model;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import static javax.persistence.GenerationType.SEQUENCE;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author aretter
 */

@Entity
@Table(name="category", schema="public")
public class Category implements Serializable {
    
    private Integer id;
    private String term;
    
    public Category(){
    }
    
    public Category(String term) {
        this.term = term;
    }

    @Id
    @SequenceGenerator(name="generator", sequenceName="category_id_seq")
    @GeneratedValue(strategy=SEQUENCE, generator="generator")
    @Column(name="id", unique=true, nullable=false)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name="term", nullable=false, length=50)
    public String getTerm() {
        return term;
    }

    public void setTerm(String term) {
        this.term = term;
    }
}