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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:43:55+00:00 2026-05-24T09:43:55+00:00

I have the following domain object : class DbDeployment { static constraints = {

  • 0

I have the following domain object:

 class DbDeployment 
 { 
   static constraints = { 
    startDate(nullable: false) 
    endDate(nullable: true) 
    username(nullable: true) 
    fabric(nullable: false) 
    description(nullable: true) 
    status(nullable: true) 
    details(nullable: true) 
   } 

   static mapping = { 
    columns { 
     details type: 'text' 
     } 
   } 

  Date startDate = new Date() 
  Date endDate 
  String username 
  String fabric 
  String description 
  String status 
  String details // xml representation of the plan 
} 

I would like to be able to run a query like this:

DbDeployment.findAllByFabric("f1", params)

but I would like to ensure the column details (which is potentially huge) is not retrieved.

Is there a way to do this?

  • 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-24T09:43:58+00:00Added an answer on May 24, 2026 at 9:43 am

    Option 1: Create an association for the large data field(s)

    One suggestion from this answer is to break the large data property out into a separate domain, which will cause it to load lazily. Example:

    class DbDeployment {
        Date startDate = new Date()
        Date endDate
        ...
        DbDeploymentDetails details
    }
    
    class DbDeploymentDetails {
        String details
        static belongsTo = DbDeployment
    }
    

    Option 2: Using a new domain + mapping to the original table

    An answer on a different question links to a Grails mailing list question which has a great answer from Burt Beckwith, but the SO answer doesn’t give an example. For the sake of posterity I’ll yoink his example from the mailing list and put it here.

    It involves creating another domain class without the large field, and then using its static mapping closure to map to the other domain’s table.

    class DbDeployment {
        Date startDate = new Date()
        Date endDate
        ...
        String details
    }
    
    class SimpleDbDeployment {
        Date startDate = new Date()
        Date endDate
        ...
        // do not include String details
    
        static mapping = {
            table 'db_deployment'
        }
    }
    

    Then you can just use the finders on SimpleDbDeployment:

    SimpleDbDeployment.findAllByFabric('f1', params)
    

    Burt, it’d be great if you would re-answer with your example from the mailing list; I’ll cut it out of mine and upvote yours, since you deserve the credit.

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

Sidebar

Related Questions

So let's say we have a domain object such as the following public class
I have the following domain object: public class Data { public virtual int ID
I have the following domain object: public class DomainObject<T,TRepo> where T : DomainObject<T> where
If I have the following domain object: public class Customer { public virtual Guid
I have the following domain object: public class Bank : IEntity { } And
I have the following models. # app/models/domain/domain_object.rb class Domain::DomainObject < ActiveRecord::Base has_many :links_from, :class_name
I have the following config in my lighttpd.conf: $HTTP[host] == trac.domain.tld { server.document-root =
I have the following code in a class that is called from a web
Suppose i have the following class. public class Location { public Id { get;
I've got a simple domain object, Movie , with the following constructor: public Movie(string

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.