/**
 * ContextDAO.java
 * Created on May 16, 2008
 * (C) Copyright TANDBERG Television Ltd.
 */
package com.tandbergtv.watchpoint.pmm.dao;

import org.apache.log4j.Logger;
import org.hibernate.Session;

import com.tandbergtv.watchpoint.pmm.dao.hibernate.HibernateDAO;
import com.tandbergtv.watchpoint.pmm.entities.Context;

/**
 * @author spuranik
 *
 */
public class ContextHDAO extends HibernateDAO<Context, Long> implements IContextDAO {

	private Session session;
	
	/**
	 * @param session
	 */
	public ContextHDAO(Session session) {
		super(Context.class, session);
		this.session = session;
	}

	/* (non-Javadoc)
	 * @see com.tandbergtv.workflow.dao.HibernateDAO#findByKey(java.io.Serializable)
	 */
	@Override
	public Context findByKey(Long key) {
		Logger log = Logger.getLogger(this.getClass());
		log.debug("Finding Entity in the DB with key: " + key.toString());
		Context context = (Context)session.get(Context.class, key);
		log.debug("Found Entity in the DB with key: " + key.toString());
		return context;
	}

}
