我对函数“ $ expand”有疑问。我有两个实体A和B,其中B是A(一对多)的属性。问题在于,在我放置分页的两个实体中,休眠状态正在获取所有数据,并且花费大量时间。我尝试使用提取类型,映射和连接列,但无济于事。 这里是休眠请求。
@OneToMany(mappedBy = "attributes", fetch = FetchType.private
List<TenderLotAttribute> tenderLotAttributes=new ArrayList<>();
Hibernate:
select
count(distinct cashlot0_.cash_lot_id) as col_0_0_
from
cash.cash_lots cashlot0_
Hibernate:
select
cashlot0_.cash_lot_id as col_0_0_,
cashlot0_.cash_id as col_0_1_
from
cash.cash_lots cashlot0_ limit ?
Hibernate:
select
distinct cashlota1_.lot_attribute_value as col_0_0_,
cashlota1_.cash_lot_id as col_1_0_,
cashlota1_.lot_attribute_name as col_2_0_
from
cash.cash_lots cashlot0_
inner join
odata.lot_attributes_exp cashlota1_
on cashlot0_.cash_lot_id=cashlota1_.cash_lot_id
order by
cashlota1_.cash_lot_id asc
如何优化休眠请求?请帮助。