I have a simple Login system using HIBERNATE and JavaBeans.
Everything almost works perfect. Except that when I try to update a table about LOG_STATUS of a user it takes much delay that, it stops responding.
The prob occurs in ChatUserLogDAO’s(present in com.hibernate package) updateLog()[method in ChatUserLogDAO.java]. The getSession.createQuery(queryString) makes it slow. Removal of that line responds faster, but i need to update the table.Whats the solution and whats the prob with it? createQuery method returns a Query object, but why does it doesnt respond? It worked for 3times, but later it stopped responding!
Please find time to help me out.
here is the abstract code :
//ChatUserLogDAO.java
public void updateLog(String userName, String logStatus){
String queryString = “update ChatUserLog set LOG_TIME = CURRENT_TIMESTAMP, LOG_STATUS='”+logStatus+”‘ WHERE USER_NAME='”+userName+”‘”;
String commit = “commit”;
*==> Query queryObject = getSession().createQuery(queryString);
int aff_rows = queryObject.executeUpdate();
if(aff_rows>0)
System.out.println(“LOG_STATUS Updated!!..”);
else
System.out.println(“LOG_STATUS Failed!!..”);
queryObject = getSession().createSQLQuery(commit);
queryObject.executeUpdate();
}
Every declaration and implementations are right.