/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package kuues; 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.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; /** * * @author Opetaja */ @Entity @Table(name="koerad") public class Koer implements java.io.Serializable{ private int id; private String koeranimi; private Peremees peremees; @Id @Column(name="id") @GeneratedValue(strategy= GenerationType.AUTO) public int getId() { return id; } public void setId(int id) { this.id = id; } @Basic @Column(name="koeranimi") public String getKoeranimi() { return koeranimi; } public void setKoeranimi(String koeranimi) { this.koeranimi = koeranimi; } @ManyToOne(cascade=CascadeType.ALL) @JoinColumn(name="peremehe_id") public Peremees getPeremees() { return peremees; } public void setPeremees(Peremees peremees) { this.peremees = peremees; } }