fields icon indicating copy to clipboard operation
fields copied to clipboard

f:all does not resolve label keys properly for child domain objects

Open snowindy opened this issue 13 years ago • 1 comments

Hello I have domains like this:

Charge{
    BudgetIndex budgetIndex
}
BudgetIndex{
    PaymentEnumType paymentType
}

page edit.gsp for Charge contains

<f:all bean="chargeInstance"/>

/_field/budgetIndex/_input.gsp contains

<f:all bean="${value}"/>

When I enter /charge/edit/1 I see that labels for bean budgetIndex are defaults, not the ones I specified in message.properties.

Digging into the problem shows that this is because label is resolved with incorrect code

budgetIndex_$$_javassist_10.paymentType.label

The message code should have been:

budgetIndex.paymentType.label

Again, this is because of hibernate proxy objects.

To see the code I added println here:

private String resolveMessage(List<String> keysInPreferenceOrder, String defaultMessage) {
    def message = keysInPreferenceOrder.findResult { key ->
        println "key = $key"
        message(code: key, default: null) ?: null
    }
    message ?: defaultMessage
}

snowindy avatar Nov 06 '12 14:11 snowindy

See comment in PR.

sbglasius avatar Apr 27 '15 03:04 sbglasius