Skip to content

Commit

Permalink
GRAILS-5781 - replaced what was a bit of a hack with a better solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Brown committed Jan 26, 2010
1 parent ce39192 commit 4372d32
Showing 1 changed file with 2 additions and 4 deletions.
Expand Up @@ -29,8 +29,6 @@ class HibernateNamedQueriesBuilder {
private final domainClass
private final dynamicMethods

private boolean initializationComplete = false

/**
* @param domainClass the GrailsDomainClass defining the named queries
* @param grailsApplication a GrailsApplication instance
Expand Down Expand Up @@ -58,7 +56,6 @@ class HibernateNamedQueriesBuilder {
closure.resolveStrategy = Closure.DELEGATE_ONLY
closure.delegate = this
closure.call()
initializationComplete = true
}

private handleMethodMissing = {String name, args ->
Expand All @@ -71,7 +68,7 @@ class HibernateNamedQueriesBuilder {
}

def methodMissing(String name, args) {
if (!initializationComplete && args && args[0] instanceof Closure) {
if (args && args[0] instanceof Closure) {
return handleMethodMissing(name, args)
}
throw new MissingMethodException(name, HibernateNamedQueriesBuilder, args)
Expand Down Expand Up @@ -168,6 +165,7 @@ class NamedCriteriaProxy {

private getPreparedCriteriaClosure() {
def closureClone = criteriaClosure.clone()
closureClone.resolveStrategy = Closure.DELEGATE_FIRST
if (namedCriteriaParams) {
closureClone = closureClone.curry(namedCriteriaParams)
}
Expand Down

0 comments on commit 4372d32

Please sign in to comment.