package info.bukova.isspst.dao.jpa;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import info.bukova.isspst.dao.QueryDao;

public class QueryDaoJPA implements QueryDao {
	
	private SessionFactory sessionFactory;
	
	public void setSessionFactory(SessionFactory factory) {
		this.sessionFactory = factory;
	}

	@Override
	public Query getQuery(String query) {
		return sessionFactory.getCurrentSession().createQuery(query);
	}

	@Override
	public Session getSession() {
		return sessionFactory.getCurrentSession();
	}

}
