I have an entity (Author) and a controller action that displays all authors.
def index = {
def list = Author.list()
render(view: 'index', model: ['allauthors' : list])
}
When rendering the page, one request is executed, as expected:
Hibernate:
select
this_.id as id0_0_,
this_.version as version0_0_,
this_.name as name0_0_
from
author this_
However, when I press Refresh (F5), the select statement is executed for each author (here I have 3 authors):
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=?
Why is this happening???
source
share