Fórumok

Creating an entity named 'Service' with Service Builder

Milen Tilev, módosítva 9 év-val korábban

Creating an entity named 'Service' with Service Builder

New Member Bejegyzések: 4 Csatlakozás dátuma: 2014.04.02. Legújabb bejegyzések
Hello all,

I am rather new to Liferay development. We are migrating a customer's legacy application to Liferay 6.2 GA2. We use maven as build tool and Liferay IDE in Eclipse.

One of the database tables we work with is named SERVICE. When I define a corresponding enitity within our service.xml and run liferay:build-service, there is an error in generated source file ServiceLocalServiceBaseIml.java:

/**
 * Returns the service with the primary key.
 *
 * @param serviceId the primary key of the service
 * @return the service
 * @throws PortalException if a service with the primary key could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public Service getService(long serviceId)
    throws PortalException, SystemException {
    return servicePersistence.findByPrimaryKey(serviceId);
}


In Eclipse the method is annotaded with
The method getService(long) of type ServiceLocalServiceBaseImpl must override or implement a supertype method
.

Looking at the cooresponding generated source file of the implemented interface ServiceLocalService shows that it is missing a method with the same signature, too. The generated service artifacts for other entities we use do contain a corresponding method get<ENTITY_NAME>(<PRIMARY_KEY_TYPE>).

Can someone please tell me what is going wrong here? Is this a known Liferay issue or are we missconfiguring something? The entity in our service.xml looks like this:

<entity name="Service" local-service="true" remote-service="false" table="service">
	<column name="serviceId" type="long" primary="true"></column>
	<column name="name" type="String"></column>
	<column name="entranceDate" type="Date"></column>
	<column name="remark" type="String"></column>
</entity>


Thanks in advance.

Milen
thumbnail
David H Nebinger, módosítva 9 év-val korábban

RE: Creating an entity named 'Service' with Service Builder

Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Service cannot be used as an entity as it will conflict w/ methods generated by Liferay. Fortunately I believe it is one of the few 'reserved' entity names that you cannot use.
thumbnail
Jack Bakker, módosítva 9 év-val korábban

RE: Creating an entity named 'Service' with Service Builder

Liferay Master Bejegyzések: 978 Csatlakozás dátuma: 2010.01.03. Legújabb bejegyzések
an issue that has been reported: see https://issues.liferay.com/browse/LPS-27710
thumbnail
David H Nebinger, módosítva 9 év-val korábban

RE: Creating an entity named 'Service' with Service Builder

Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Milen Tilev:
<entity name="Service" local-service="true" remote-service="false" table="service">
	<column name="serviceId" type="long" primary="true"></column>
	<column name="name" type="String"></column>
	<column name="entranceDate" type="Date"></column>
	<column name="remark" type="String"></column>
</entity>



Note that you can change the entity name and use the existing table and all should work:

<entity name="LegacyService" local-service="true" remote-service="false" table="service">...</entity>
Milen Tilev, módosítva 9 év-val korábban

RE: Creating an entity named 'Service' with Service Builder

New Member Bejegyzések: 4 Csatlakozás dátuma: 2014.04.02. Legújabb bejegyzések
Hello David, Jack,

Thanks for your responses. I'll choose a different name for that entity.

Kind regards,

Milen