Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8229579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:50:34+00:00 2026-06-07T16:50:34+00:00

i have an entity (Author) and a controller action that renders all the authors.

  • 0

i have an entity (Author) and a controller action that renders all the authors.

def index = {
    def list = Author.list()
    render(view: 'index', model: ['allauthors' : list])
}

When rendering the page, a single query 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) then a 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 this happends???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:50:35+00:00Added an answer on June 7, 2026 at 4:50 pm

    It looks like this has to do with the query cache. If you have

    cache.use_query_cache = true
    

    in your Datasource.groovy but do NOT have cacheing set up in your domain class the cache appears to be evicting all of the entries on each list() and having to re-cache each one (just a guess).

    If you add cacheing to your domain the multiple selects go away – in fact NO selects are done when I refresh after adding this:

    static mapping = {
        cache true
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my business model I have Entity class (IPoint interface ) that has a
I have entity model like this (using EclipseLink and JPA 2.0): @Entity class A
i have an entity Entity1 that have one to many relation with Entity2 as
I have a Model called Version that looks like this: from google.appengine.ext import db
Let's say I have an entity Author which has a name can write 0
I have a Core Data entity, OrderItem that has a to-many relationship to another
suppose that I have this RDBM table ( Entity-attribute-value_model ): col1: entityID col2: attributeName
I have a blog application that models a database using Entity Framework. The problem
From examples that I have seen online and in a Programming Entity Framework CodeFirst
I have some Entities that look like this: @Entity public abstract class AbstractEntity{ @Id

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.