Package dao

Source Code of dao.CorectiaTemperaturiiDao

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package dao;

import bo.HibernateUtil;
import bo.Corectiatemperaturii;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import daoI.ICorectiaTemperaturiiDao;

public class CorectiaTemperaturiiDao implements ICorectiaTemperaturiiDao {

    Session session = null;

    public Float getTempCititaByTemp(float temp) {

        Corectiatemperaturii tempC = null;
        List<Corectiatemperaturii> temCList = null;

        try {
            session = (Session) HibernateUtil.getSessionFactory().getCurrentSession();
            org.hibernate.Transaction tx = session.beginTransaction();
            Query q = session.createQuery("from Corectiatemperaturii as lang where lang.temp='" + temp + "'");
            temCList = (List<Corectiatemperaturii>) q.list();
            if (temCList.size() > 0) {
                tempC = ((Corectiatemperaturii) temCList.get(0));
                tx.commit();
                return tempC.getCorectiaTemp();
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
        return (float)0.0;
    }
}
TOP

Related Classes of dao.CorectiaTemperaturiiDao

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.