JPACachingEntityProvider LazyLoadingException

I’m triyng to use Cached provider but got LazyLoadingException, the use case is the following:
My ComplexObject has some simple properties (say. Title, Description, EndDate, etc.) and some @OneToMany collection properties (say. Documents)

  • first I show to the user a list (Table) of my Objects, on the table I get only some simple properties (Title, Desciption)
  • when the user select an itema and open detail form to edit it, on the form all properties should be showned, here I got the LazyLoadingException.

I thought about using two providers,
one cached for table and another uncached for the form,
but then I should notify changes of the item from the first to the second provider,

is this the way to do or is there a smarter way ?

Regards

Another option I found is to disable cache before open form and reenable after the form is opened, like this


        provider.setCacheEnabled(false);
        open(new ComplexObjectForm( ((JPAContainer<T>) getContainerDataSource()).getItem(getValue()) ));
        provider.setCacheEnabled(true);

but I don’t know if this is a correct way anyway.

Please suggest me your opinion.

Yes I solved, the problem was that I acces property directly and not as descibed into Vaadin Book: