Package com.evasion.plugin.geoloc.dao

Source Code of com.evasion.plugin.geoloc.dao.CountryDAO

/*
* 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<Country, Long> {

    /**
     * *
     * 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;
    }
}
TOP

Related Classes of com.evasion.plugin.geoloc.dao.CountryDAO

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.