Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
How to manage extended type with JPAContainer
I would like your opinion on my problem about JPAContainer
First, here my model :
Person 0,n -------- 1,1 Execute 1,1 ------- 0,n Task
-id - date
a "Worker" (with specific property salary) extends a "Person" (with property id) and a "Person" can "Execute" many Task and a "Task" can be excuted by many "Person".
My problem :
I want display in a table all the "Execute" recording with a specific property of Worker (If a person is a "Worker").
I want display in my table : person.id - execute.date - worker.salary
It's easy to create a table with JPAContainer and add "nested container property" to display person id ; but I don't know how can I do to display the value of the property "salary" from worker ; because the "Execute" object has only a property with a type "Person" and not a type "Worker" (all the same a "Person" can be a "Worker").
How the JPAContainer can manage the property who has "extended type" ?
Thanks a lot for your return
This sort of things becomes pretty complex with JPAContainer as well as with other Container implementations. Thus I'll just have to do the same suggestion that I have recently done for almost all JPAContainer questions: don't use it.
You'd probably be much better of if you'd create a very simple wrapper bean for your entities that contains exactly the properties that you want to display. Then you'll have full control on how and what should be displayed and you probably also have a better typed (~easier to use) API to do this. Then you can just use BeanItemContainer to list the stuff and fall back to e.g. lazy loading implementations in Viritin if you end up into memory usage issues with really large tables.
Thank you so much for your reply and have a good day