我有双向多对一关联
<class name="Person">
<id name="id" column="personId">
<generator class="native"/>
</id>
<set name="addresses"
table="PersonAddress">
<key column="personId"/>
<many-to-many column="addressId"
unique="true"
class="Address"/>
</set>
</class>
<class name="Address">
<id name="id" column="addressId">
<generator class="native"/>
</id>
<join table="PersonAddress"
inverse="true"
optional="true">
<key column="addressId"/>
<many-to-one name="person"
column="personId"
not-null="true"/>
</join>
</class>
当我在应用程序中的hql查询下运行以使Person表中的所有数据与PersonAddress和Address保持连接状态,但是在所有数据为5k时需要花费2分钟以上的时间来加载数据,请帮助我减少时间?
session.createQuery("from Person b ");
下面是表格结构
create table Person ( personId bigint not null primary key )
create table PersonAddress ( personId bigint not null, addressId bigint not null)
create table Address ( addressId bigint not null primary key )