facebook

Delay while performing updations to table in Hibernate3.2

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #310895 Reply

    Karthik
    Member

    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.

    #310899 Reply

    aceventura18,

    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.

    #310917 Reply

    Karthik
    Member

    Yes you were right Shalini. Thanks for your support. I sorted it out! Take care.

    #310925 Reply

    aceventura18,
    Good to know that you could get that working.
    Do let us know if you have any issues

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Delay while performing updations to table in Hibernate3.2

This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.

You must be logged in to post in the forum log in