All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.evasion.plugin.geoloc.dao.CountryDAO Maven / Gradle / Ivy

The newest version!
/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
package com.evasion.plugin.geoloc.dao;

import com.evasion.dao.api.AbstractJPAGenericDAO;
import com.evasion.entity.geolocation.AdminDivision;
import com.evasion.entity.geolocation.City;
import com.evasion.entity.geolocation.Country;
import javax.persistence.NoResultException;
import javax.persistence.Query;

/**
 * DAO pour la manipulation des Business Object de type {@link City}.
 *
 * @author sebastien
 */
public class CountryDAO extends AbstractJPAGenericDAO {

    /**
     * *
     * serialVersionUID.
     */
    private static final long serialVersionUID = 1L;

    public Country findByCtCode(String code) {
        Country result;
        Query query = (Query) getEntityManager().
                createNamedQuery(Country.QUERY_FIND_BY_COUNTRY_CODE);
        query.setParameter(1, code);
        try {
            result = (Country) query.getSingleResult();
        } catch (NoResultException ex) {
            result = null;
        }
        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy