Grails

totalCount is broken

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 2.0-RC1
  • Fix Version/s: 2.0-RC2
  • Component/s: Persistence
  • Labels:
  • Environment:
    Win 7

Description

totalCount property to get the number of entries after applying a criteria query is broken.
For example, having

def authorList = Author.createCriteria().list(max: params.max, offset: params.offset){
            ilike('name', '%a%')
        }

authorList.totalCount always returns the total number of Author records and not only those with 'a' symbol in 'name' field.

Issue Links

Activity

Hide
Fat Zopilot added a comment -

Same issue here. The criteria is just omitted in the SQL query that is generated when totalCount is invoked/accessed.
In 1.3.7. there was an additional limit (at least in the query where I stumbled upon this issue) which is missing as well.
Win 7, Postgres 9.0, postgresql-9.1-901.jdbc4, JDK 6.0.29 (all 64-bit)

Show
Fat Zopilot added a comment - Same issue here. The criteria is just omitted in the SQL query that is generated when totalCount is invoked/accessed. In 1.3.7. there was an additional limit (at least in the query where I stumbled upon this issue) which is missing as well. Win 7, Postgres 9.0, postgresql-9.1-901.jdbc4, JDK 6.0.29 (all 64-bit)
Hide
Jeff Brown added a comment -

Fat and Leonid,

We will get this straight for RC2. Thanks for the help.

Show
Jeff Brown added a comment - Fat and Leonid, We will get this straight for RC2. Thanks for the help.
Hide
Fat Zopilot added a comment -

2.0.0.BUILD-SNAPSHOT: Now there is an additional "order by lower" in the generated select count query if there is a "sort 'property'" in the domain class' mapping section. Suggest to reopen.

Show
Fat Zopilot added a comment - 2.0.0.BUILD-SNAPSHOT: Now there is an additional "order by lower" in the generated select count query if there is a "sort 'property'" in the domain class' mapping section. Suggest to reopen.
Hide
Jeff Brown added a comment -

Fat,

Please raise a separate JIRA with relevant details and we will see about getting that straightened out.

Thanks for the help.

Show
Jeff Brown added a comment - Fat, Please raise a separate JIRA with relevant details and we will see about getting that straightened out. Thanks for the help.

People

Vote (4)
Watch (6)

Dates

  • Created:
    Updated:
    Resolved: