vaadin JPAcontainer and nested properties problem
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开发者_Python百科 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.
What's wrong? How can I use nested property field on form to display some information.
It's possible to modify ExchangeRate nested properties?
Answer is there: vaadin forum
- 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.
- 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.
精彩评论