首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Hibernate JPA 的目录的使用

2012-09-14 
Hibernate JPA 的索引的使用在Hibernate中Model中一个对象关联的对象相当多是必须使用索引,如果多个表关联

Hibernate JPA 的索引的使用
在Hibernate中Model中一个对象关联的对象相当多是必须使用索引,如果多个表关联更要使用关联,否则效率相等的低下,例如在项目中酒店的查询中大约有几千条数据但是查询就需要5分钟以上,实在是一个严重的效率瓶颈,采用的方案,在集合等地方添加相应的索引,加快搜索效率。
如下:
针对重复几率比较大的使用索引:

/*** 现付含早frontBreakfast(旧),周一~周日*/@CollectionOfElements@JoinTable(name = "T_RTP_CASH_BT")@Type(type = "breakfastTypeEnum")@IndexColumn(name = "cashBreakfastTypes_pos")private List<BreakfastType> cashBreakfastTypes = getDefaultBreakfastType();

还有各种各种情况必须添加相应的索引。

热点排行