- This topic has 3 replies, 2 voices, and was last updated 14 years, 2 months ago by support-shalini.
-
AuthorPosts
-
KarthikMemberI 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.
support-shaliniMemberaceventura18,
It worked for 3times, but later it stopped responding!
This looks more like a data base related issue. This can be caused when certain locks are placed on the rows that are being updated. I would recommend you to check with your database administrator for any blocked sessions on the DB.
KarthikMemberYes you were right Shalini. Thanks for your support. I sorted it out! Take care.
support-shaliniMemberaceventura18,
Good to know that you could get that working.
Do let us know if you have any issues -
AuthorPosts