我有三个实体:
Users(id, username, password...); BoughtItems(id, userid, itemcat, itemid); ItemCustomizations(id(id of item), slot(id of color), color)
当我在BoughtItems.java中获取这样的信息时:
@OneToMany(fetch = FetchType.EAGER, mappedBy = "id")
@OrderBy("slot")
private List<ItemCustomization> customColors = new ArrayList<>();
Hibernate要求数据库提供每个项目:
Hibernate: select customcolo0_.itemid as itemid1_2_0_, customcolo0_.itemid
as itemid1_3_0_, customcolo0_.slot as slot2_3_0_, customcolo0_.itemid as
itemid1_3_1_, customcolo0_.slot as slot2_3_1_, customcolo0_.color as
color3_3_1_ from shop_customizations customcolo0_ where
customcolo0_.itemid=? order by customcolo0_.slot
我的问题
如何适当地优化我的映射以减少mysql
服务器性能的影响?
我可以以某种方式将查询/项优化为1个查询吗?
https://stackoverflow.com/questions/35377231
复制相似问题