package com.eyrolles.model;

import java.util.Collection;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

import com.fasterxml.jackson.annotation.JsonBackReference;

@Entity
@Table(name="publieurs")
public class Publieur {
	@Id @GeneratedValue(strategy=GenerationType.AUTO)
	private int id;	
	private String nom;
	private String prenom;
	private String pays; 
	private String activite;
	@OneToMany(mappedBy="publieur")
	@Cascade({CascadeType.ALL})
	@JsonBackReference
	private Collection<Livre> livres;
	
	
	
	public Publieur() {
		super();
	}
	public Publieur(String nom, String prenom, String pays) {
		super();
		this.nom = nom;
		this.prenom = prenom;
		this.pays = pays;
		
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getNom() {
		return nom;
	}
	public void setNom(String nom) {
		this.nom = nom;
	}
	public String getPrenom() {
		return prenom;
	}
	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}
	public String getActivite() {
		return activite;
	}
	public void setActivite(String activite) {
		this.activite = activite;
	}
	public Collection<Livre> getLivres() {
		return livres;
	}
	public void setLivres(Collection<Livre> livres) {
		this.livres = livres;
	}
	public String getPays() {
		return pays;
	}
	public void setPays(String pays) {
		this.pays = pays;
	}
	
}