package com.eassessment.pojo;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

@Entity
@Table(name = "topics")
public class Topics {

	@Id
//	@GeneratedValue
	int topic_id;
	
	@Column(name = "topic_name", nullable = false, unique=true)
	String topic_name;

	@OneToMany(targetEntity = Questions.class, mappedBy = "topics", cascade = CascadeType.ALL)
	@LazyCollection(LazyCollectionOption.FALSE) 
	List<Questions> questions;

	public int getTopic_id() {
		return topic_id;
	}

	public void setTopic_id(int topic_id) {
		this.topic_id = topic_id;
	}

	public String getTopic_name() {
		return topic_name;
	}

	public void setTopic_name(String topic_name) {
		this.topic_name = topic_name;
	}

	public List<Questions> getQuestion() {
		return questions;
	}

	public void setQuestion(List<Questions> questions) {
		this.questions = questions;
	}

	@Override
	public String toString() {
		return "Topics [topic_id=" + topic_id + ", topic_name=" + topic_name
				+ "]";
	}

	
	 
	
}
