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 3404510
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:23:31+00:00 2026-05-18T05:23:31+00:00

I have a frustrating problem with the criteria builder. I have an application in

  • 0

I have a frustrating problem with the criteria builder. I have an application in which one user has one calendar, and a calendar has many entries. Seems straightforward enough, but when I try to get the calendar entries for a given user, I can’t access the user property (MissingMethodException). Here’s the code:

def getEntries(User user) {
  def entries = [ClassName].createCriteria().list() {
    calendar {
      user {
        eq("id", user.id)
      }
    }
  }
}

I have even tried the following variation:

def getEntries(User user) {
  def entries = [ClassName].createCriteria().list() {
    calendar {
      eq("user", user)
    }
  }
}

That did not raise an exception, but didn’t work either.

Here’s the relevant parts of the domain classes:

class Calendar {
    static belongsTo = [user: User]
    static hasMany = [entries: Entries]

    ...
}

class User {
    Calendar calendar

    ...
}

class Entry {
    static belongsTo = [calendar: Calendar]

    ...
}

When Googling I came across a similar problem noted in early 2008:
http://jira.codehaus.org/browse/GRAILS-1412

But according to that link this issue should have been solved long ago.

What am I doing wrong?

  • 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-05-18T05:23:32+00:00Added an answer on May 18, 2026 at 5:23 am

    I finally found the error!! The error wasn’t at all related to criteria builder. The problem in this case was that I had user variable in the scope, so when I tried to enter the user relation by

    calendar {
      user {
        eq("id", user.id)
      }
    }
    

    Grails thought that I wanted to call the user object/variable with a closure. I can once again use criteria builders freely 🙂

    Thanks for all your help and suggestions guys!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very frustrating problem which I cannot result. Its just not adding
I have a frustrating problem. With the following code in my clsExchange which is
I have a frustrating problem with an asp.net mvc view containing the Microsoft Chart
Ok, I have a very frustrating problem. I am parsing a webpage and need
I've been dealing with a frustrating problem recently. I have a lot of reflection
I'm facing a frustrating issue. I have an application where the scroll wheel doesn't
i have a frustrating problem with registering global hook. I am using this class
I have a frustrating problem. I'm building a view engine in ASP.NET MVC and
I am having a very frustrating problem with Microsoft Visual Web Developer. I have
I have constant problem with cookies on my Django site which is set up

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.