Skip to content

groovy.lang.MissingPropertyException on reading property from a domain sub classs #14550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
swzaidi opened this issue Aug 31, 2018 · 0 comments

Comments

@swzaidi
Copy link

swzaidi commented Aug 31, 2018

I have the following domain classes in my test app


class PricePlan {

String id
double price

static mapping = {
    id type: 'string', generator: 'assigned'
    discriminator column: 'purchase_type'
}

}


class RecurringPricePlan extends PricePlan {

int durationInMonths

static mapping = {
    discriminator 'Subscription'
}

}

class SubscriptionPlan {

PricePlan pricePlan

static constraints = {
    pricePlan nullable: true

}

int getDurationInMonths() {

    pricePlan.durationInMonths
}

}

Steps to reproduce

  1. save RecurringPricePlan
  2. Assign the saved RecurringPricePlan to new SubscriptionPlan
  3. save SubscriptionPlan
  4. Find SubscriptionPlan by id
  5. invoke subscriptionPlan.getDurationInMonths()
  6. getting following exception
    groovy.lang.MissingPropertyException: No such property: durationInMonths for class: RecurringPricePlan
    Possible solutions: durationInMonths

Can you please let me know why i am seeing this error?

@jdaugherty jdaugherty transferred this issue from apache/grails-data-mapping Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants