package com.fp.armas.portal.model;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Version;


/**
 * The persistent class for the TGENEPROVINCE database table.
 * 
 */
@Entity
public class Tgeneprovince implements Serializable {
	private static final long serialVersionUID = 1L;

	@EmbeddedId
	private TgeneprovincePK id;

	private String description;

	@Version
	private Long recordversion;

	//bi-directional many-to-one association to Tgenecanton
	@OneToMany(mappedBy="tgeneprovince")
	private Set<Tgenecanton> tgenecantons;

	//bi-directional many-to-one association to Tgenecountry
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="COUNTRYCODE")
	private Tgenecountry tgenecountry;

	public Tgeneprovince() {
	}

	public TgeneprovincePK getId() {
		return this.id;
	}

	public void setId(TgeneprovincePK id) {
		this.id = id;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Long getRecordversion() {
		return this.recordversion;
	}

	public void setRecordversion(Long recordversion) {
		this.recordversion = recordversion;
	}

	public Set<Tgenecanton> getTgenecantons() {
		return this.tgenecantons;
	}

	public void setTgenecantons(Set<Tgenecanton> tgenecantons) {
		this.tgenecantons = tgenecantons;
	}

	public Tgenecanton addTgenecanton(Tgenecanton tgenecanton) {
		getTgenecantons().add(tgenecanton);
		tgenecanton.setTgeneprovince(this);

		return tgenecanton;
	}

	public Tgenecanton removeTgenecanton(Tgenecanton tgenecanton) {
		getTgenecantons().remove(tgenecanton);
		tgenecanton.setTgeneprovince(null);

		return tgenecanton;
	}

	public Tgenecountry getTgenecountry() {
		return this.tgenecountry;
	}

	public void setTgenecountry(Tgenecountry tgenecountry) {
		this.tgenecountry = tgenecountry;
	}

}