Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
How to manage extended type with JPAContainer
Hello,
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
^
|
|
| (Extends)
|
|
Worker
- salary
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").
For example:
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
Guillaume
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.
cheers,
matti