Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vaadin + JPA + lazy loading

I have Vaadin application backed by JPA. Components in this application are bound to bean properties (via standalone EL implementation). Some of components are bound to external objects (or their fields), linked by @OneToOne, @OneToMany, @ManyToOne and @ManyToMany annotations. The binding performed by implementing com.vaadin.data.Property and setting it as DataSources of components.

The question is: will lazy loading work in "Property"ies if component will be refreshed somehow (by vaadin's ajaxes) after the form is served to browser?

like image 358
Askar Kalykov Avatar asked Dec 07 '25 05:12

Askar Kalykov


1 Answers

If you have set your PersistanceContext on your EntityManager to PersistenceContextType.EXTENDED then your entities will handle this and hence also vaadin. If you dont have it then you will have to load them manualy.

@PersistenceContext(unitName = "yourname", type=PersistenceContextType.EXTENDED)
private EntityManager entityManager;
like image 125
Marthin Avatar answered Dec 10 '25 22:12

Marthin