package fr.plil.sio.examen.api; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; /** * An animal must have a name one and only one owner */ @Entity @Table(name="ANIMAL_T") public class Animal implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(name="NAME_A",nullable = false) private String name; @ManyToOne(optional = false) @JoinColumn(name="OWNER_ID") private Owner owner; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Owner getOwner() { return owner; } public void setOwner(Owner owner) { this.owner = owner; } }