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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:57:10+00:00 2026-05-14T21:57:10+00:00

I use Hibernate/Spring and a MySQL Database for my data management. Currently I display

  • 0

I use Hibernate/Spring and a MySQL Database for my data management.

Currently I display a tree-structure in a JTable. A tree can have several branches, in turn a branch can have several branches (up to nine levels) again, or having leaves. Lately I have performanceproblemes, as soon as I want to create new branches on deeper levels.

At this time a branch has a foreign key to its parent. The domainobject has access to its parent by calling getParent(), which returns the parent-branch. The deeper the level, the longer it takes to create a new branch.

Microbenchmark results for creating a new branch are like:

Level 1: 32 ms.
Level 3: 80 ms.
Level 9: 232 ms.

Obviously the level (which means the number of parents) is responsible for this. So I wanted to ask, if there are any appendages to work around this kind of problem. I don’t understand why Hibernate needs to know about the whole object tree (all parents until the root) while creating a new branch. But as far as I know this can be the only reason for the delay while creating a new branch, because a branch doesn’t have any other relations to any other objects.

I would be very thankful for any workarounds or suggestions.

greets,
ymene

  • 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-14T21:57:10+00:00Added an answer on May 14, 2026 at 9:57 pm

    Basically you are having some sort of many to one relationships structure right?
    In hibernate all depends on mapping. Tweak your mapping, Use One-to-many relationship from parent to child using java.util.Set.

    Do not use ArrayList becasue List is ordered, so hibernate will add extra column for that ordering only.

    Also check your lazy property. If you load parent and you have set lazy=”false” on its child set property, then all of its children will be loaded from DB which can affect the performance.

    Also check ‘inverse’ property for children. If inverse is true in child table, that means you can manage the child entity separately. Otherwise you have to do that using the parent only.

    google around for inverse, it will sure help you.

    thank.

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

Sidebar

Related Questions

We use Spring + Hibernate for a Webapp. This Webapp will be deployed on
I'm about to use MySQL with Hibernate on a Tomcat 5.5.x server. Do I
I'm trying to use NHibernate for data access, and I have 2 simple entities
How to get Hibernate session inside a Hibernate Interceptor? I'm trying to use Hibernate
I'm taking on the re-architecting of a pair of applications which use Hibernate in
Do you always use a second-level cache in Hibernate or do you first try
Can I use Fluent NHibernate API for .NET 2.0 applications.
I use NHibernate for my dataacess, and for awhile not I've been using SQLite
I'm new to NHibernate. If I use NHibernate to generate GUIDs for inserts to
I am able to use the NHibernate Criteria API for an IN statement using

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.