com.evasion.plugin.travel.dao.RoadMapDAO Maven / Gradle / Ivy
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.evasion.plugin.travel.dao;
import com.evasion.dao.api.AbstractJPAGenericDAO;
import com.evasion.entity.booktravel.RoadMap;
import java.util.List;
import javax.persistence.Query;
/**
* DAO pour la manipulation des Business Object de type {@link RoadMap}.
* @author sebastien
*/
public class RoadMapDAO extends AbstractJPAGenericDAO {
public List selectRoadMapByDescendingExecutionDate(
final Long idBookTravel, final int maxResult) {
Query query = getEntityManager().createQuery("select r " +
"from RoadMap r " +
"where r.bookTravel.id=:id " +
"order by r.executionDateInternal desc");
query.setParameter("id", idBookTravel);
if (maxResult>0) {
query.setMaxResults(maxResult);
}
return query.getResultList();
}
}