我有一个实体(作者)和一个呈现所有作者的控制器操作。
def index = {
def list = Author.list()
render(view: 'index', model: ['allauthors' : list])
}
呈现页面时,会按预期执行单个查询:
Hibernate:
select
this_.id as id0_0_,
this_.version as version0_0_,
this_.name as name0_0_
from
author this_
但是,当我按刷新 (F5) 时,将为每个作者执行一条选择语句(这里我有 3 个作者):
Hibernate:
select
author0_.id as id0_0_,
author0_.version as version0_0_,
author0_.name as name0_0_
from
author author0_
where
author0_.id=?
Hibernate:
select
author0_.id as id0_0_,
author0_.version as version0_0_,
author0_.name as name0_0_
from
author author0_
where
author0_.id=?
Hibernate:
select
author0_.id as id0_0_,
author0_.version as version0_0_,
author0_.name as name0_0_
from
author author0_
where
author0_.id=?
为什么会出现这种情况???