Grails

Problem With Conjunctions And Disjunctions In Named Queries

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.2 final
  • Fix Version/s: 1.2.1, 1.3-M1
  • Component/s: Persistence
  • Labels:
    None

Description

The following named query results in SQL with no WHERE clause:

grails-app/domain/MyDomain.groovy
class MyDomain implements Serializable {
  String userId 
  String reportsTo
  String positionNum

  static mapping = {
    table 'some_legacy_table'
    version false
    cache usage: 'read-only'
    userId column: 'USER_OPRID'
    reportsTo column: 'REPORTS_TO'
    positionNum	column: 'POSITION_NBR'
    id composite:['userId', 'reportsTo', 'positionNum']
  }

  static namedQueries = {
    userAccessList { user, manager, position ->
      and {
        eq( 'userId', user )
        or {
          eq 'reportsTo', manager
          eq 'positionNum', position
        }
      }
    }
  }
}

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: