Object requiring time to be stored in sleep mode

I have three objects in which I am trying to save only 1 object right now. All three objects are shown below: -

1. Student essence

     <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 object

     <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 Object: -

    <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 StudentEntity with relevant Sectionand SportsTeamdetails, it takes a long time to save it to the database. Currently, I run it for about 10,000 students, and this process (only ongoing) takes about 15 minutes. I added some loggers to calculate the total time.

Now I need to reduce this time, since we will briefly move from 10,000 to 1 million records, and, as estimated, it takes a lot of time. I need to reduce time, how can I do this?

, : -

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)

,

+3
3

.

, , , IMO, , . . , .

+4

, SportsTeam. , Student, Student, Section SportsTeam . , 10000 , 10000 SportsTeam 10000 .

: 1. 2. db ( hql) SportsTeam 3. SportsTeam , 3. SportsTeam 2. 4. .

"" 1000 . hibernate DB/Network, .

+1

I would specify the length for the string properties; otherwise they can be implemented as clobs

+1
source

All Articles