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();
}