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 8751889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:07:52+00:00 2026-06-13T13:07:52+00:00

I have a list of Transaction objects. List<Transaction> transactions; I need to batch process

  • 0

I have a list of Transaction objects.

List<Transaction> transactions;

I need to batch process these transactions by creating a pool of threads which update transactions concurrently.
These threads update these transactions using the same DAO class(Spring singleton bean) to update the transaction. I’m using Hibernate as ORM

What am I to consider to make sure my code is thread safe? I’m a bit confused.

Here’s the DAO class. SessionFactory is also defined as a Spring bean which is then autowired to DAO class.

@Autowired
SessionFactory sessionFactory;

@Override
public Transaction update(Transaction transaction) {
    Session session = sessionFactory.openSession();
    session.beginTransaction();

    session.update(transaction);

    session.getTransaction().commit();
    return transaction;
}
  • 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-13T13:07:53+00:00Added an answer on June 13, 2026 at 1:07 pm

    To get much better performance look at pooling the DB connections, there are open source implementations like c3p0 which works nicely with spring and hibernate. This is particularly import for batch processing.

    Are you using the hibernate implementation of SessionFactory? If that is the case then it is indeed thread safe so you should be good.

    Another suggestion is to look at spring batch which might be useful for your situation.

    Update: you’ve already said you are using Hibernate so the SessionFactory should be good.

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

Sidebar

Related Questions

Assuming I have a list of financial transactions, I have a need to execute
I have list of transaction objects and want to order them by certain condition
I have a table (dump) with transactions, and I want to list the total
I have List I want to sort Desc by Priority, which is int and
In a list of transaction objects, I am attempting to group by BatchNo then
I have a couple of domain objects which I am trying to save using
having some doubts with LINQ queries over objects... I have this filter descriptions which
I have a problem when I try to persist objects using multiple threads .
I have a backend process that maintains state in a PostgreSQL database, which needs
Is Finnish_Swedish_CI_AS collation backed by a Latin-1 translation? Anyone have a good translation list

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.