package com.peetz.library.entity;

import java.util.ArrayList;
import java.util.Collection;

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

@Entity
@Table(name="FILE")
public class FileEntity {
	private Long id;
	
	private String title;
	
	private Collection<ArticleEntity> articles = new ArrayList<ArticleEntity>();
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Long getId() { return id; }
	
	@SuppressWarnings("unused")
	private void setId(Long id) { this.id = id; }

	@Column
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@OneToMany(mappedBy="file", cascade=CascadeType.REMOVE)
	public Collection<ArticleEntity> getArticles() {
		return articles;
	}

	public void setArticles(Collection<ArticleEntity> articles) {
		this.articles = articles;
	}

}
