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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:18:02+00:00 2026-05-26T17:18:02+00:00

I have a domain class using some transient property foo. Now I want to

  • 0

I have a domain class using some transient property foo. Now I want to use listOrderByFoo on this property but I get the error “could not resolve property: foo”.
Is there any way to use transient properties in listOrderByProperty() or findByProperty() ?

class Bar {
 String name
 static transients = ['foo']
 def getFoo() {
   ...
 }
}

Bar.findAllByFooIsNotNull()
Bar.listOrderByFoo()
  • 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-26T17:18:03+00:00Added an answer on May 26, 2026 at 5:18 pm

    Unfortunately no. Like Matt said in his comment to your question, since those fields are marked as transient, they are not persisted to the database and thus there’s no way for you to query them. If you want to find or list by a transient property, you’ll need to write a closure to iterate over a list of objects with the transient property already set. There’s no dynamic GORM method that you can use to do it.

    def bars = [ new Bar(foo:1), new Bar(foo:2), new Bar(foo:4), new Bar(foo:3) ];
    
    // Find bar with foo=3
    bars.find { it.foo == 3 }
    
    // Sort bars by foo
    bars.sort { a,b -> a.equals(b)? 0: a.foo<b.foo? -1: 1 }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using transient properties per domain class. Some of them have more than
Assume I have this domain object... public class SpansMultipleTables { public int CommonID {get;
I have some code looking like this: using System.Threading; public sealed class MyClass :
I have designed some classes using Visual Studio class diagramming. Now I would like
I have a class in my domain model called JobPlan this class is stored
I have a class in my domain model root that looks like this: namespace
Lets say I have some domain objects that will need to be serialized/packed using
I have the following domain model setup using EF code first: public class User
I have a domain class containing a couple of fields. I can access them
If I have a Client domain class, and that Client hasMany Courses. How do

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.