Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7812737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:36:34+00:00 2026-06-02T04:36:34+00:00

I’m building a web portal and i’m using Hibernate to access MySQL and push

  • 0

I’m building a web portal and i’m using Hibernate to access MySQL and push the data fetched to a JSP to print it in a tabular form. I’m using Tomcat for servlet deployment. my servlet has to make 3 HQL queries and then push the data retrieved to the JSP. after i deploy the servlet,it works fine the first time i make a query using HTML form. moreover,in the Eclipse console,i can see all the 3 HQL queries being executed. but when i try to make a query again, even the same query as last time from my HTML form, I dont get any data on the JSP page(the table i was trying to fill contains only zeroes). checking the Eclipse console,i found that only the first HQL query was executed,and nothing else comes up,not even an error message. If i restart Tomcat,or just redeploy the servlet,it works,but only once again. please help

The flow is like-
HTML form -> Servlet -> JSP

         String major,date,minor,ip;
         double[][][] transactionTime = new double[2][50][10];
         int[] testCaseId = new int[10];
         String[] activityName = new String[10];
         major=req.getParameter("major");
         date=req.getParameter("date");
         minor=req.getParameter("minor");
         ip=req.getParameter("ip");
         String testCaseName=req.getParameter("testCaseName");
         Session session = null;


      try{

      SessionFactory sessionFactory = new 

    Configuration().configure()
    .buildSessionFactory();
      session =sessionFactory.openSession();

      //Create Select Clause HQL


         String SQL_QUERY2 ="Select testCases.activityName,testCases.testCaseID from TestCases testCases where testCases.testcaseName like \'" + testCaseName + "\'";
         Query query2 = session.createQuery(SQL_QUERY2);
         for(Iterator it2=query2.iterate();it2.hasNext();ctr2++)
              {
              Object[] act = (Object[]) it2.next();
              activityName[ctr2]=(String) act[0];
              testCaseId[ctr2] = (Integer) act[1];
              }


        for(int j=0;j<ctr2;j++){
            ctr=0;
         String SQL_QUERY3 ="Select tran.transactionTime from Transactions tran where tran.samples.builds.buildMajorVersion like " + major + " and tran.samples.builds.buildMinorVersion like " + minor + " and tran.samples.runDate like \'" + date + "\' and tran.testCases.testCaseID like " + testCaseId[j] + " and tran.samples.testbeds.server.ipv4Address like \'" + ip + "\'";
         Query query3 = session.createQuery(SQL_QUERY3);
         for(Iterator it3=query3.iterate();it3.hasNext();ctr++)
              {
              Object time = (Object) it3.next();
              transactionTime[0][j][ctr]=(Double) time;
              int precision = 100;
              transactionTime[0][j][ctr] = Math.floor(transactionTime[0][j][ctr]*precision+0.5)/precision;
              }
        }



        for(int j=0;j<ctr2;j++){
            ctr3=0;
         String SQL_QUERY5 ="Select tran.transactionTime from Transactions tran where tran.samples.builds.buildMajorVersion like " + major + " and tran.samples.builds.buildMinorVersion like " + minor + " and tran.samples.baseline=1";
         Query query5 = session.createQuery(SQL_QUERY5);
         for(Iterator it5=query5.iterate();it5.hasNext();ctr3++)
              {
              Object time = (Object) it5.next();
              transactionTime[1][j][ctr3]=(Double) time;
              int precision = 100;
              transactionTime[1][j][ctr3] = Math.floor(transactionTime[1][j][ctr3]*precision+0.5)/precision;
              }
        }





 session.close();
      }
      catch(Exception e){
          System.out.println(e.getMessage());
      }
      finally{

      }







    req.setAttribute("major",major);
    req.setAttribute("minor",minor);
    req.setAttribute("date",date);
    req.setAttribute("ip",ip);
    req.setAttribute("testCaseName",testCaseName);
    req.setAttribute("transactionTime", transactionTime);
    req.setAttribute("activityName", activityName);
    req.setAttribute("sampleNumBase", ctr3);
    req.setAttribute("sampleNumRun", ctr);
      req.getRequestDispatcher("/WEB-INF/src/BaselineRawData.jsp").forward(req, res);  
 }

}

Console output in Eclipse on First and successful run

Hibernate: 
    select
        testcases0_.activityName as col_0_0_,
        testcases0_.testCaseID as col_1_0_ 
    from
        TestCases testcases0_ 
    where
        testcases0_.testcaseName like 'Deploy 200 tunings on 10 devices with 0 tunings' Hibernate: 
    select
        transactio0_.transactionTime as col_0_0_ 
    from
        Transactions transactio0_ cross 
    join
        Samples samples1_ cross 
    join
        Builds builds2_ cross 
    join
        TestBeds testbeds7_ cross 
    join
        Machines server8_ 
    where
        transactio0_.sampleId=samples1_.sampleId 
        and samples1_.buildId=builds2_.buildId 
        and samples1_.testBedId=testbeds7_.testBedId 
        and testbeds7_.serverId=server8_.machineId 
        and (
            builds2_.buildMajorVersion like 4
        ) 
        and (
            builds2_.buildMinorVersion like 4434
        ) 
        and (
            samples1_.runDate like '2012-02-25'
        ) 
        and (
            transactio0_.testCaseId like 1
        ) 
        and (
            server8_.ipv4Address like '10.104.52.200'
        ) Hibernate: 
    select
        transactio0_.transactionTime as col_0_0_ 
    from
        Transactions transactio0_ cross 
    join
        Samples samples1_ cross 
    join
        Builds builds2_ cross 
    join
        TestBeds testbeds7_ cross 
    join
        Machines server8_ 
    where
        transactio0_.sampleId=samples1_.sampleId 
        and samples1_.buildId=builds2_.buildId 
        and samples1_.testBedId=testbeds7_.testBedId 
        and testbeds7_.serverId=server8_.machineId 
        and (
            builds2_.buildMajorVersion like 4
        ) 
        and (
            builds2_.buildMinorVersion like 4434
        ) 
        and (
            samples1_.runDate like '2012-02-25'
        ) 
        and (
            transactio0_.testCaseId like 2
        ) 
        and (
            server8_.ipv4Address like '10.104.52.200'
        ) Hibernate: 
    select
        transactio0_.transactionTime as col_0_0_ 
    from
        Transactions transactio0_ cross 
    join
        Samples samples1_ cross 
    join
        Builds builds2_ cross 
    join
        TestBeds testbeds7_ cross 
    join
        Machines server8_ 
    where
        transactio0_.sampleId=samples1_.sampleId 
        and samples1_.buildId=builds2_.buildId 
        and samples1_.testBedId=testbeds7_.testBedId 
        and testbeds7_.serverId=server8_.machineId 
        and (
            builds2_.buildMajorVersion like 4
        ) 
        and (
            builds2_.buildMinorVersion like 4434
        ) 
        and (
            samples1_.runDate like '2012-02-25'
        ) 
        and (
            transactio0_.testCaseId like 3
        ) 
        and (
            server8_.ipv4Address like '10.104.52.200'
        ) Hibernate: 
    select
        transactio0_.transactionTime as col_0_0_ 
    from
        Transactions transactio0_ cross 
    join
        Samples samples1_ cross 
    join
        Builds builds2_ cross 
    join
        TestBeds testbeds7_ cross 
    join
        Machines server8_ 
    where
        transactio0_.sampleId=samples1_.sampleId 
        and samples1_.buildId=builds2_.buildId 
        and samples1_.testBedId=testbeds7_.testBedId 
        and testbeds7_.serverId=server8_.machineId 
        and (
            builds2_.buildMajorVersion like 4
        ) 
        and (
            builds2_.buildMinorVersion like 4434
        ) 
        and (
            samples1_.runDate like '2012-02-25'
        ) 
        and (
            transactio0_.testCaseId like 4
        ) 
        and (
            server8_.ipv4Address like '10.104.52.200'
        ) Hibernate: 
    select
        transactio0_.transactionTime as col_0_0_ 
    from
        Transactions transactio0_ cross 
    join
        Samples samples1_ cross 
    join
        Builds builds2_ cross 
    join
        TestBeds testbeds7_ cross 
    join
        Machines server8_ 
    where
        transactio0_.sampleId=samples1_.sampleId 
        and samples1_.buildId=builds2_.buildId 
        and samples1_.testBedId=testbeds7_.testBedId 
        and testbeds7_.serverId=server8_.machineId 
        and (
            builds2_.buildMajorVersion like 4
        ) 
        and (
            builds2_.buildMinorVersion like 4434
        ) 
        and (
            samples1_.runDate like '2012-02-25'
        ) 
        and (
            transactio0_.testCaseId like 5
        ) 
        and (
            server8_.ipv4Address like '10.104.52.200'
        ) Hibernate: 
    select
        transactio0_.transactionTime as col_0_0_ 
    from
        Transactions transactio0_ cross 
    join
        Samples samples1_ cross 
    join
        Builds builds2_ cross 
    join
        TestBeds testbeds7_ cross 
    join
        Machines server8_ 
    where
        transactio0_.sampleId=samples1_.sampleId 
        and samples1_.buildId=builds2_.buildId 
        and samples1_.testBedId=testbeds7_.testBedId 
        and testbeds7_.serverId=server8_.machineId 
        and (
            builds2_.buildMajorVersion like 4
        ) 
        and (
            builds2_.buildMinorVersion like 4434
        ) 
        and (
            samples1_.runDate like '2012-02-25'
        ) 
        and (
            transactio0_.testCaseId like 6
        ) 
        and (
            server8_.ipv4Address like '10.104.52.200'
        ) Hibernate: 
    select
        transactio0_.transactionTime as col_0_0_ 
    from
        Transactions transactio0_ cross 
    join
        Samples samples1_ cross 
    join
        Builds builds2_ 
    where
        transactio0_.sampleId=samples1_.sampleId 
        and samples1_.buildId=builds2_.buildId 
        and (
            builds2_.buildMajorVersion like 4
        ) 
        and (
            builds2_.buildMinorVersion like 4434
        ) 
        and samples1_.baseline=1 10

Console output in Eclipse on Subsequent and unsuccessful runs

Hibernate: 
    select
        testcases0_.activityName as col_0_0_,
        testcases0_.testCaseID as col_1_0_ 
    from
        TestCases testcases0_ 
    where
        testcases0_.testcaseName like 'Deploy 200 tunings on 10 devices with 0 tunings'
10
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T04:36:36+00:00Added an answer on June 2, 2026 at 4:36 am

    Hardik said
    Problem seems with ctr2. As your loop iteration are based on that. Where it gets initialized ?

    The problem was that ctr2 and ctr were declared and initialised outside d servlet code

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.