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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:02:05+00:00 2026-05-23T02:02:05+00:00

I have three entities, in which i try to save only 1 entity right

  • 0

I have three entities, in which i try to save only 1 entity right now. All the three entities are shown below :-

1. Student Entity

     <class name="com.school.Student" table="TABLE_STUDENT">
        <id name="id" type="long">
            <column name="ST_ID" />
            <generator class="native" />
        </id>
        <property name="name" type="string" column="ST_NAME"/>
        <many-to-one name="studentSection" class="com.school.Section" fetch="select">
            <column name="SECTION_ID" not-null="true" />
        </many-to-one> 
        <many-to-one name="studentSportsTeam" class="com.school.SportsTeam" fetch="select">
            <column name="SPORTS_TEAM" not-null="true" />
        </many-to-one>
     </class>

2. Section Entity

     <class name="com.school.Section" table="TABLE_SECTION">
         <id name="sectionId" type="string">
            <column name="SECTION_ID" />
            <generator class="assigned" />
        </id>
        <property name="floor" type="string" column="SEC_FLOOR"/>
        <property name="capcacity" type="int" column="SEC_CAPACITY"/>
        <set name="studentDetails" inverse="true" lazy="true" table="TABLE_STUDENT" fetch="select">
            <key>
                <column name="SECTION_ID" not-null="true" />
            </key>
            <one-to-many class="com.school.Student" />
        </set>
     </class>

3. SprotsTeam Entity :-

    <class name="com.school.SportsTeam" table="TABLE_SPORTS">
         <id name="sportsTeamId" type="string">
            <column name="SPORTS_TEAM" />
            <generator class="assigned" />
        </id>
        <property name="noOfPlayers" type="int" column="SPORTS_PLAYER_NUM"/>
        <property name="captainName" type="string" column="SPORTS_CAPTAIN_NAME"/>
        <set name="playerDetails" inverse="true" lazy="true" table="TABLE_STUDENT" fetch="select">
            <key>
                <column name="SPORTS_TEAM" not-null="true" />
            </key>
            <one-to-many class="com.school.Student" />
        </set>
     </class>

Now if i try to save Student Entity with proper Section and SportsTeam details, it takes a lot of time to persist it into the database. Currently i am running it for around 10000 students and this process (only persisting) takes around 15 mins. I added some loggers to calculate the complete time.

Now i need to reduce this time, as we will shorty move from 10,000 to 1 million records, and as calculated it takes very long time.. I need to reduce the time , how can i do that??

As Required, also the schema is as below :-

TABLE STUDENT :

ST_ID               NUMBER,
ST_NAME             VARCHAR(40),
SECTION_ID          VARCHAR(10),
SPORTS_TEAM         VARCHAR(10)

TABLE_SECTION :

SECTION_ID          VARCHAR(10),
SEC_FLOOR           VARCHAR(2),
SEC_CAPACITY        NUMBER

TABLE_SPORTS :

SPORTS_TEAM                  VARCHAR(10),
SPORTS_PLAYER_NUM            NUMBER,
SPORTS_CAPTAIN_NAME          VARCHAR(40)

Please help

  • 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-23T02:02:06+00:00Added an answer on May 23, 2026 at 2:02 am

    Consider batch inserts.

    Moreover, if this batch inserts is just for once i.e. as a part of migration process, then IMO, you can consider dropping all primary keys — and any other indices, on the tables, and then insert the records. After that re-create all those. Hopefully, you would notice a significant improvement.

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

Sidebar

Related Questions

I have UI automation tests. Tests involve three entities - Data object class -
I have three core data entities which I am importing into, they are: •
I have the following entities: @Entity public class Alert implements Serializable { private long
I have three entities: EntityA, EntityB and EntityC connected with to-many relationships. See schema
I have a case where i have three entities with one-to-many and one-to-many relationships:
I have three tables tag , page , pagetag With the data below page
I have three models: class ReleaseItem < ActiveRecord::Base has_many :pack_release_items has_one :pack, :through =>
I have a Model in an existing Datastore. Which looks like this: class SomeKind(db.Model):
I have an entity (JPA annotations with Hibernate query interface) which has a composite
I have a WCF client which passes Self-Tracking Entities to a WPF application built

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.