/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package kuues; import java.util.*; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.OneToMany; import javax.persistence.Table; /** * * @author Opetaja */ @Entity @Table(name="peremehed") public class Peremees implements java.io.Serializable{ private int id; private String eesnimi; private List koerad; @Id @Column(name="id") @GeneratedValue(strategy= GenerationType.AUTO) public int getId() { return id; } public void setId(int id) { this.id = id; } @Basic @Column(name="eesnimi") public String getEesnimi() { return eesnimi; } public void setEesnimi(String eesnimi) { this.eesnimi = eesnimi; } @OneToMany(cascade=CascadeType.ALL, mappedBy="peremees") public List getKoerad() { return koerad; } public void setKoerad(List koerad) { this.koerad = koerad; } }