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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:42:46+00:00 2026-05-14T08:42:46+00:00

I have 5 MySQL InnoDB tables: Test,InputInvoice,InputLine,OutputInvoice,OutputLine and each is mapped and functioning in

  • 0

I have 5 MySQL InnoDB tables: Test,InputInvoice,InputLine,OutputInvoice,OutputLine and each is mapped and functioning in Hibernate. I have played with using StatelessSession/Session, and JDBC batch size. I have removed any generator classes to let MySQL handle the id generation- but it is still performing quite slow.
Each of those tables is represented in a java class, and mapped in hibernate accordingly. Currently when it comes time to write the data out, I loop through the objects and do a session.save(Object) or session.insert(Object) if I’m using StatelessSession. I also do a flush and clear (when using Session) when my line count reaches the max jdbc batch size (50).

  1. Would it be faster if I had these in a ‘parent’ class that held the objects and did a session.save(master) instead of each one?
  2. If I had them in a master/container class, how would I map that in hibernate to reflect the relationship? The container class wouldn’t actually be a table of it’s own, but a relationship all based on two indexes run_id (int) and line (int).
  3. Another direction would be: How do I get Hibernate to do a multi-row insert?
  • 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-05-14T08:42:46+00:00Added an answer on May 14, 2026 at 8:42 am

    The final solution for me was to use voetsjoeba’s response as a jumping off point.
    My hibernate config uses the following options:

    hibernate.order_inserts = true
    hibernate.order_updates = true
    
    • I changed from using Session to
      StatelessSession

    • Re-ordered the
      Java code to process all the elements
      in a batch a table at a time. So all
      of table x, then table y, etc.

    • Removed the <generator> from each
      class. Java now creates it and
      assigns it to the object

    • Created logic that allowed me to determine if just
      an id was being set and not write
      ’empty’ lines to the database

    • Finally, I turned on dynamic-insert
      for my classes in their hibernate
      definitions like so: <class name="com.my.class" table="MY_TABLE" dynamic-insert="true">

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

Sidebar

Related Questions

How can I get Hibernate (using JPA) to create MySQL InnoDB tables (instead of
I have a MySql db with innoDB tables. Very simplified this is how two
I have two mysql tables, one containing details on cars and one containing all
I have a mysql database which has grown to over 200 tables in it.
Anyone knows how to get sum of number? For example i have mysql column
I have a MySQL query that returns a result with a single column of
I have a MySQL table with approximately 3000 rows per user. One of the
I have a MySQL database behind a firewall which can only be accessed via
I have a MySQL database table with a couple thousand rows. The table is
I have a MySQL database of keywords that are presently mixed-case. However, I want

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.