package com.peetz.tradingcards.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@NamedQueries({
    @NamedQuery(name="Team.findAll", query="SELECT t from TeamEntity as t"),
    @NamedQuery(name="Team.findByName", query="SELECT t from TeamEntity as t WHERE t.name = :name")
})

@Entity
@Table(name="TEAM")
public class TeamEntity {

    private Long id;
    private String name;
    private SportEntity sport;

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    public Long getId() { return id; }
	
    @SuppressWarnings("unused")
    private void setId(Long id) { this.id = id; }

    @Column
    public String getName() { return name; }

    public void setName(String name) { this.name = name; }

    @ManyToOne
    public SportEntity getSport() { return sport; }

    public void setSport(SportEntity sport) { this.sport = sport; }
}
