Creating a liferay service constructor without configuring any database

Is it possible to create a liferay service constructor without any configuration of the database tables in the service.xml file.

Actually, the goal here is to create a service level using the liferay service builder. And there is no interaction with the database directly at this service level.

+6
source share
3 answers

Yes, and it's pretty simple. Although you still need an entity (which provides a name for your service), you can leave this object definition empty.

This will create a service (local or remote, as configured in essence), but has no model, no persistence, and no database table.

One of the situations when it is very convenient is when you want to add another method to an existing service (which you cannot) - you simply create a new service using your own methods and delegate it to the original service.

+2
source

It is highly recommended that at least one entity must exist when creating Service.xml. Otherwise, there is no need to add this configuration.

0
source

I agree with @Olaf Kock answare which says it is possible to have an empty model with a service builder. In addition, you have an empty object with which you can use the same transactional context of your portal, as well as the benefits of cluster management and the benefits of full integration with the liferay portal.

If you have the same transactional portal environment, you can create an image that aggregates your own liferay service, and you can be sure that the transactional context is the same portal.

I hope this reflection can add value.

0
source

All Articles