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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:19:28+00:00 2026-05-28T01:19:28+00:00

I have a Foo domain class with an embedded Bar field: class Foo {

  • 0

I have a Foo domain class with an embedded Bar field:

class Foo {
  Bar bar

  static embedded=['bar']
}

class Bar {
  String ham
}

Which gives me a foo table with a bar_ham column.

The problem is that my Foo.bar and Bar.ham have much longer names in reality, so the column ends up having more than 30 characters in length, which Oracle doesn’t like.

So how can I customize the name of the embedded column?

I’ve tried something like the following, but it didn’t work:

class Foo {
  Bar bar

  static embedded=['bar']

  static mapping={
    bar column:'b'
  }
}
  • 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-28T01:19:29+00:00Added an answer on May 28, 2026 at 1:19 am

    Specify the customized column name on the Bar class, like so:

    class Foo {
      Bar bar
    
      static embedded=['bar']
    
    }
    
    
    class Bar {
        String bazIsReallyLong
    
        static mapping = {
            bazIsReallyLong column:'baz'
        }
    }
    

    Tested on Grails 2.0, this created a Foo table with column names ID, VERSION, and BAZ.

    This will affect all tables containing Baz, however.


    Updates based on comment

    Another options is to change the name of the mapped class to something shorter, like this:

    class Foo {
      Bar b
    
      static embedded=['b']
    
    }
    
    
    class Bar {
        String bazIsReallyLong
    }
    

    This creates the column B_BAZ_IS_REALLY_LONG, which at least helps.

    I don’t see any options for explicitly renaming embedded columns otherwise.

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

Sidebar

Related Questions

I have a domain foo.com on server bar. I have a subdomain api.foo.com which
I have model Foo which has field bar. The bar field should be unique,
I have a System.Uri, e.g., var uri = new Uri(http://www.domain.com/foo/bar); How do I get
I have: class Foo; class Bar { Foo foo; Bar(): foo(foo) {}; } Bar
I have: class Foo { int a; int b; std::string s; char d; };
I have a domain class using some transient property foo. Now I want to
I have a base class Foo that has an Update() function, which I want
I'm using Grails 1.3.7. Let's say I have the domain objects Foo and Bar
I have two parts to a site, foo.domain.com and bar.domain.com (with bar.domain.com really being
I have 2 different domain, let's call them www.foo.com and bar.foo.com. The first one

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.