36 lines
1.0 KiB
Plaintext
Executable File
36 lines
1.0 KiB
Plaintext
Executable File
package com.fp.armas.portal.dao.registro;
|
|
|
|
import java.util.Collection;
|
|
|
|
import javax.persistence.criteria.CriteriaBuilder;
|
|
import javax.persistence.criteria.CriteriaQuery;
|
|
import javax.persistence.criteria.Root;
|
|
|
|
import com.fp.armas.portal.dao.general.GenericDaoImpl;
|
|
import com.fp.armas.portal.model.Tgenecountry;
|
|
import com.fp.armas.portal.util.RegistroException;
|
|
|
|
/**
|
|
* Objeto de acceso a datos de la tabla {@link Tgenecountry}
|
|
* @author dcruz
|
|
*
|
|
*/
|
|
public class PaisDao extends GenericDaoImpl<Tgenecountry> {
|
|
|
|
public PaisDao() {
|
|
super(Tgenecountry.class);
|
|
}
|
|
|
|
public Collection<Tgenecountry> buscarPaises() {
|
|
try {
|
|
CriteriaBuilder cb = this.getEntityManager().getCriteriaBuilder();
|
|
CriteriaQuery<Tgenecountry> query = cb.createQuery(Tgenecountry.class);
|
|
Root<Tgenecountry> tgeneCountryRoot = query.from(Tgenecountry.class);
|
|
query.select(tgeneCountryRoot).orderBy(cb.asc(tgeneCountryRoot.get("description")));
|
|
return this.getEntityManager().createQuery(query).getResultList();
|
|
} catch (Throwable e) {
|
|
throw new RegistroException(e);
|
|
}
|
|
}
|
|
}
|