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

  • SEARCH
  • Home
  • 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 6711729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:10:32+00:00 2026-05-26T08:10:32+00:00

I have a strange bug with Grails. I want to get back some persisted

  • 0

I have a strange bug with Grails. I want to get back some persisted datas, so I execute a HQL query for it. I need to retrieve a list from a domain class, which has a manyToOne relation.

The query is pretty basic, look by yourself :

def listActuel = PositionnementProfil.find("FROM PositionnementProfil as pp where pp.positionnement.libelle='actuel'")

But I get this error :

Error 500: Executing action [positionnement] of controller [package.ProfilController] caused exception: Invalid query [FROM PositionnementProfil as pp where pp.entreprise.libelle=’Orange’] for domain class [class package.PositionnementProfil]

So in doubt, I’ve tried with a more basic query, just to get sure, and as I kept on having this kinf of error I decided to try with another class. Still got this marvelous message with this piece of code :

def test = Profil.find("FROM Profil as p where p.firstName like='Jean'")
//NOtice I executed more complex queries on this class with success, here not

Eevn though I’m new in grails I don’t think I’m a noob (please God, tell me I did everything right 😀 ), I followed once again grails doco (http://grails.org/doc/latest/guide/5.%20Object%20Relational%20Mapping%20%28GORM%29.html#5.4.3%20Hibernate%20Query%20Language%20%28HQL%29), I cleaned my project by executing “grails clean”, restarted my computer, and still got this nice problem. I don’t know why, but it seems to have troubles only in this part of my code :

class ProfilController {

def scaffold = Profil


    def positionnement = {
        def test = Profil.find("from profil as p where p.firstName like 'Jean'")
    }

    //... I've put this code in other places, but I don't believe in "supernatural" places
}

I really din’t see how to get out of this. Other symptom, Netbeans doesn’t seen to recognize GORM autocompletion.

  • 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-26T08:10:33+00:00Added an answer on May 26, 2026 at 8:10 am

    I think I remember a recent issue with case-sensitivity with find() and findAll() but that won’t help you since the fix will be in 2.0. But the easy workaround is to use executeQuery() instead since that’s just a direct hook into Hibernate HQL:

    def listActuel = PositionnementProfil.executeQuery(
           "FROM PositionnementProfil as pp where pp.positionnement.libelle='actuel'")[0]
    

    The only difference other than the method name is that since executeQuery() returns a List you need to take the 1st element with [0]

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

Sidebar

Related Questions

I have a very strange bug, which I believe is caused by some code
I have come across some strange behaviour, and I'm assuming a bug in Firefox,
I seem to have run into a strange bug or more likely some setting
I am using Mockito 1.9 with Grails 1.3.7 and I have a strange bug.
I have a very strange bug going on. I cannot get the flyout to
I have a strange bug where I call an insert query, it executes successfully
I have a strange bug. I launch a PHP Unit test Suite. At the
I have a strange bug happening in my script. I have 3 balls on
I have a really strange enum bug in Java. for(Answer ans : assessmentResult.getAnswersAsList()) {
I have found what appears to be a strange bug with sqlite. I have

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.