Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What should be done to get around or resolve the PrimeFaces exception requiring the definition of a lazy attribute or one that doesn't result in null?

Tags:

primefaces

I am in the progress of upgrading a legacy application from PrimeFaces 6.2 to 11.0.0 (which is the newest available with maven - https://mvnrepository.com/artifact/org.primefaces/primefaces). I have had to make a number of changes, including adding Object as the parameter for RowEditEvent and TreeNode objects (which are now generic) and changing instantiations of DefaultStreamedContent to use .builder(). Now, I am facing the following error whenever I try to run the application and navigate to certain pages:

"javax.faces.FacesException: Unable to automatically determine the lazy attribute. Either define the lazy attribute on the component or make sure the value attribute doesn't resolve to null."

It looks like an exception is being thrown rather than a warning as is noted in the conversation here: https://github.com/primefaces/primefaces/issues/8436. It also looks like it was fixed, but for version 12 (which is not on the maven central repository).

I am wondering what my options are, or what could be done about this. Should I go back to an older version?

like image 266
ConfusedUbuntist Avatar asked Dec 02 '25 17:12

ConfusedUbuntist


2 Answers

As a workaround you could create an application factory which sets the lazy attribute to false.

See: https://primefaces.github.io/primefaces/11_0_0/#/core/globalattributes

like image 193
Jasper de Vries Avatar answered Dec 06 '25 08:12

Jasper de Vries


Is it a lazy DataTable which uses LazyDataModel? If yes, just set lazy=true, otherwhise set lazy=false

like image 30
tandraschko Avatar answered Dec 06 '25 06:12

tandraschko