Issue
-
If the service builder entity has the attribute trash-enabled="true" defined, the corresponding abstract methods were generated for the model & wrapper classes(FooModel, FooModelImpl, FooWrapper) for Liferay dxp 7.4.13.u18 & earlier bundles. However, the service builder for Liferay dxp 7.4.13.u49 version doesn’t generate these methods on buildService Command and this causes compilation errors due to these missing methods in the generated code.
Environment
- DXP 7.4 U49+
Resolution
- This issue usually occurs because of the misuse of the latest version of ServiceBuilder to build the services, which might be incompatible with U49 and older versions. The project should be configured to use version 1.0.439 of the ServiceBuilder, since that version is the one that is compatible with U49.
- The detailed explanation is that prior to U52, we had a TrashHandler interface that contained a number of trash-related methods. The ServiceBuilder generated Model classes that extended/implemented this interface if "trash-enabled" was set to true, and included implementations of these methods in the Model classes.
In U52 (LPS-152611) we removed these methods from the TrashHandler interface, in favor of the methods of the same name in the TrashHelper interface. We also updated the ServiceBuilder to no longer implement these methods in the Model classes. - In U49, TrashHandler interface still contains these methods. However, if the latest version of ServiceBuilder is used, the generated Model classes do not implement these methods. Therefore, you get compile-time errors like "FooWrapper is not abstract and does not override abstract method isInTrashImplicitly() in TrashedModel", because the method exists in TrashedModel, but not in the generated ServiceBuilder code.
Contenido exclusivo para suscriptores.
Una Suscripción Enterprise de Liferay proporciona acceso a más de 1.500 artículos que incluyen las mejores practicas, diagnóstico de problemas y otras soluciones útiles. Inicia sesión para tener un acceso completo.
Inicia sesión