public boolean updateLastLog(String email){
methodNM = CLASS_NAME+" updateLastLog";
log.info("in..."+methodNM);
boolean action = true;
Session session = HibernateUtil.getSession();
Date time = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String now = sdf.format(time);
System.out.println(now);
try{
String hqlQuery = "update UserProfile set lastlog = :now where usEmail = :email";
Query query = session.createQuery(hqlQuery);
query.setString("now", now);
query.setString("email", email);
query.executeUpdate();
session.flush();
}catch (Exception e) {
log.error(methodNM + e.toString());
System.out.println(methodNM + e.toString());
action = false;
return action;
}finally{
HibernateUtil.closeSession();
}
return action;
}
}
|