Marek33
(Marek Jasanský)
1
Hello,
could you give me some hint how to display more joined tables in one Vaadin Table using JPAContainer please? Or it is necessary to use SQL Container?
I tried to play with following statements, but it seems to me JPAContainer can work with entity class only:
jpaManager.createQuery("" +
"SELECT p, c.name, c.city " +
"FROM Project p " +
"JOIN p.customer c ").getResultList();
jpaContainer = JPAContainerFactory.make(Project.class, jpaManager);
jpaContainer.refresh();
super.table.setContainerDataSource(jpaContainer);
Is it efficient to retrieve query result as a List<?> and import items to JPAContainer in a cycle?
Thank you
Marek33
(Marek Jasanský)
2
Do you have any ideas please?
All replies are welcome, even:
- it is not possible
- it is part of paid support
- it requieres paid funcionality
- etc…
I just need any direction.
Thanks!
Marek33
(Marek Jasanský)
3
Uaaa, I got it!
Finally, it is easy. It is sufficient to call a getter of joined entity (table) column in class definition of main entity:
public class PurchaseInvoice {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@ManyToOne
@JoinColumn(name="supplierId")
private Company supplier;
@Transient
private String supplierName;
public String getSupplierName() {
return supplier.getName();
}
Of course it doesn’t join the whole table but only selected columns. Anyway, I am quite happy about this solution