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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:41:41+00:00 2026-06-16T21:41:41+00:00

I’m trying to map the column names of this class: class Amount{ String total

  • 0

I’m trying to map the column names of this class:

class Amount{

    String total //Total amount of something
    String type  //Type of amount, Dollars, %, Times something
    Bonification bonificationRate  //the amount can be "x times another bonification"

    static belongsTo = [parentBonification: Bonification]

    static mapping = {
       table "AMOUNTS"
       total column: "AMOU_TTOTAL"
       type column: "AMOU_TTYPE"
       parentBonification column: "BONI_CID"
       bonificationRate column: "BONI_TRATE_CID"
    }

}


class Bonification {  
    //among other things:  
    Amount amount
}

The thing is none of the field with the Bonification class are created in the DB,
not with the name I give them and neither with the default suppossed names.

Comment Edit:

  1. Both are Domain Classes;
  2. Datasource is on dbCreate = "update"
  3. I dropped the Table in Oracle and let Grails create it again. Still no Bonification columns.
  4. I can not dbCreate = "create-drop" because there is data that I can’t delete for now.
  5. I mounted a new local Derby Database with dbCreate = create-drop. Still no luck.

(PD: All other fields are persisted and mapped with the right column names, only those two Bonification fields are the problem)
Is there another way of doing this?

Grails: 1.3.9
BD: Oracle 9

Edit for asked DataSource.groovy
(External file accessed from Config.groovy
grails.config.locations = [ "file:${extConfig}/${appName}Config.groovy"])

package xx.xxx.xxxx.xxxXxxx

dataSource 
{
    pooled = true
    dialect = "org.hibernate.dialect.Oracle10gDialect"
    driverClassName = "oracle.jdbc.OracleDriver"    
    username = "XXX"
    password = "XXX" 
    properties {
                maxActive = 100
                maxIdle = 25
                minIdle = 5
                initialSize = 5
                minEvictableIdleTimeMillis = 60000
                timeBetweenEvictionRunsMillis = 60000
                maxWait = 10000
                validationQuery = "select 1 from dual"
                }

}
hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = true
    cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider'
}

// environment specific settings
environments {
    development {
println "Including external DataSource"
        dataSource {            
            dbCreate = "update"
            url = "jdbc:oracle:thin:@xxx.xxx.xx:xxxx:XXXX"
        }
    }
}
  • 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-06-16T21:41:42+00:00Added an answer on June 16, 2026 at 9:41 pm

    Ok, finally I got it.

    I used the “mappedBy” property.

    http://grails.org/doc/2.1.0/ref/Domain%20Classes/mappedBy.html

    The documentation (6.2.1.2 One-to-many) said that is for use in the “hasMany” side. That confused me because I didn’t have a hasMany but rather two field of the same type in Class Amount.
    And what I really had to do was to use the mappedBy property, not in the Amount Class, but in the Bonification Class that has just one reference to Amount.

    And with that I tell to the Amount Class, wich Bonification he has to back reference so “he” doesn’t get confused, and take the bonificationRate field just as a field and not as a reference as I think he was doing before.

    class Amount{
    
        String total //Total amount of something
        String type  //Type of amount, Dollars, %, Times something
        Bonification bonificationRate  //the amount can be "x times another bonification"
    
        static belongsTo = [parentBonification: Bonification]
    
        static mapping = {
           table "AMOUNTS"
           total column: "AMOU_TTOTAL"
           type column: "AMOU_TTYPE"
           parentBonification column: "BONI_CID"
           bonificationRate column: "BONI_TRATE_CID"
        }
    
    }
    
    
    class Bonification {  
        //among other things:  
        Amount amount
    
        static mappedBy = [amount: "parentBonification"]
    }
    

    That didn’t created the parentBonification "BONI_CID" column but it Did created the bonificationRate "BONI_TRATE_CID" wich I needed.

    Sorry if it’s too messy. Thanks for the time and help anyway.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but

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.