0

I have entity ExchangeRate {date, currencyFrom, rate} . Entity currencyFrom has properties code and Name. I add it to container addNestedContainerProperty("currencyFrom.code"); it works without problem and code is displayed in vaadin table.

Now I create BeanValidationForm and add this field to it. It crash because BeanValidationValidator it try to find getter for currencyFrom.code and looks for method getCurrencyFrom.code inside ExchangeRate.

  1. What's wrong? How can I use nested property field on form to display some information.

  2. It's possible to modify ExchangeRate nested properties?

1

1 Answer 1

1

Answer is there: vaadin forum

  1. BeanValidationForm assumes all the properties are in the main bean class - it does not know anything about JPAContainer or nested properties. Note that JSR-303 bean validation annotations are accessed directly from the bean class, not through the container.

To get around this, you must give the correct bean class to each BeanValidationValidator created - either override BeanValidationForm.addField() and give the correct bean class to BVV.addValidator(), or use BVV directly instead of using the helper class BeanValidationForm.

  1. It should be possible (at least with suitable cascade settings) - but if you have separate EntityProviders for the class of the nested instances, they are not notified of changes if you only save the nested entity as a part of the main entity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.