/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.csu.sdmx.dao;

import cz.csu.sdmx.validation.model.ValidationResult;
import java.util.Date;
import java.util.List;
import org.hibernate.Query;
import org.springframework.stereotype.Component;

/**
 *
 * @author themi
 */
@Component
public class ValidationResultsDaoImp extends DaoSupportImp<ValidationResult, Integer> implements ValidationResultsDao{
    
    public ValidationResultsDaoImp() {
        super(ValidationResult.class);
    }

    @Override
    public List<ValidationResult> getBetween(Date from, Date to) {
        String sql = "FROM "+getClassName()+" WHERE date BETWEEN :from and :to ORDER BY date DESC";
        Query q = getCurrentSession().createQuery(sql);
        q.setParameter("from", from);
        q.setParameter("to", to);
        
        return q.list();
    }
    
}
