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

  • Home
  • SEARCH
  • 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 8380849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:33:42+00:00 2026-06-09T16:33:42+00:00

It is a Q&A-style. While using SessionFactoryUtils.getSession to get a session and doing my

  • 0

It is a Q&A-style.

While using SessionFactoryUtils.getSession to get a session and doing my query, it can be call only limited count and will be waited in calling after that limit count.
Why it happens?

    try {
        SessionFactory sessionFactory = getHibernateTemplate().getSessionFactory();
        Session session = SessionFactoryUtils.getSession(sessionFactory, true);
        Query query = session.getNamedQuery("updateAField");

        query.setParameterList("states", states);

        int updatedCount = query.executeUpdate();
        return updatedCount;
    } catch (Exception e) {
        logger.error(e.toString());
        throw new Throwable(e);
    }
  • 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-09T16:33:43+00:00Added an answer on June 9, 2026 at 4:33 pm

    Because you are getting session from Hibernate but you do not release it.
    So by calling SessionFactoryUtils.closeSession(session); you have to release used session in the end of your function.
    That limit count in calling this function is your database connection pool size.
    It will be:

        SessionFactory sessionFactory = null;
        Session session = null;
        try {
            sessionFactory = getHibernateTemplate().getSessionFactory();
            session = SessionFactoryUtils.getSession(sessionFactory, true);
            Query query = session.getNamedQuery("updateAField");
    
            query.setParameterList("states", states);
    
            int updatedCount = query.executeUpdate();
            return updatedCount;
        } catch (Exception e) {
            logger.error(e.toString());
            throw new Throwable(e);
        } finally {
            if (session != null) {
                SessionFactoryUtils.closeSession(session);
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We've been using NUnit & VisualStudio to write C# .NET code for a while
I am writing my first Blog using Html&Css, Php And MySql. While writing the
I have been learning css & jquery. <!DOCTYPE html> <html> <head> <style type=text/css> #box
I want to be able to replace style=&quot;STUFF&quot; I keep thinking that this is
The HTML: <div id=timerList> ... <li rel=project class=open> <a class= style= href=><ins>&nbsp;</ins>Project C</a> </li>
I'm using VBA to parse the soap xml with MSXML2 and XPath but while
//C++ Example #include <iostream> using namespace std; int doHello (std::string&); int main() { std::string
I am using the WM_EX_TRANSPARENT window style on some windows in an attempt to
I've discovered while trying to use a luaBind-style class binding system that passing pointers
When using fonts for my application I get no warning/error/exception when a FontFamily I

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.