首页 > 解决方案 > 当数据库结构与我们在使用 hibernate 的对象关系映射中指定的不匹配时对系统性能的影响

问题描述

最近我开始非常关心使用 Hibernate 的系统性能。您可以在下面提到的关系中看到一个主应用程序只能有一个子应用程序。但是数据库包含同一个主应用程序的多个子应用程序。系统随机选择一个子应用程序,这不会导致用户可以注意到的任何问题,但我假设这会以某种方式影响我系统中堆内存方面的性能. 在这种情况下,对性能的影响是否显着?

class MainApplication{
@Column(name="main_app_id")
    int mainAppId;

    String firstName;
    String lastName;
    List<Address> address ;
}

class SupportingApplication{
    int supportingAppId;

    //defining the relation

    @Column(name="main_app_id")
    int mainAppId

    @OneToOne
    @JoinColumn(name="main_app_id", referencedColumnName="main_app_id", insertable=false, updatable=false)
    private MainApplication mainApplication;

    String city;
    String state;   
}

标签: javahibernateheap-memory

解决方案


推荐阅读