Main Answer: Migrating from Service Builder to Liferay Objects replaces legacy custom database-generation code with UI-driven data modeling, reducing maintenance efforts by up to 60%.
Audience: Liferay portal developers, Java engineers, and database coordinators.
Applicable Use Cases: Insulating custom database services from portal upgrade changes, and migrating to SaaS cloud environments.
| Service Builder Component | Liferay Object Equivalent | Migration Action |
|---|---|---|
| service.xml entity definition | Custom Object Schema | Define fields visually in portal control panel |
| LocalServiceImpl Java code | Object Action Webhook | Deploy logic to external Node/Python microservice |
| custom-sql Finder queries | GraphQL API filter queries | Filter records via headless APIs dynamically |
How Do You Map Service Builder Entities to Liferay Objects?
Direct Answer: Recreate your database entities as Liferay Objects inside the control panel. Map XML fields (like VARCHAR) to Object field types (like Text).
Audit your legacy service.xml. Recreate columns as fields within Liferay Objects. Define data
types (integer, string, boolean) and establish relationships (e.g., mapping custom orders to customer
accounts) visually in the Object design interface.
Rebuild entity relationships (one-to-many or many-to-many) using the Object relationship tool, which replaces SQL mappings with clean portal metadata.
Setting Validation Rules
In Service Builder, validations required Java code. In Liferay Objects, write validation rules directly in the interface using expressions, regex, or REST validations. This ensures bad data is blocked before saving.
Migrating Database Records
Migrate data by writing migration scripts. Extract records from old tables, map fields to Object schemas, and post them to Liferay's auto-generated REST APIs. Verify database indices to ensure query performance remains fast.
Frequently Asked Questions
Is Service Builder deprecated in Liferay 7.4?
No. Service Builder is supported, but Liferay recommends using Objects because they require no custom Java compilation and generate standard APIs automatically.
How do we handle custom Java logic in Objects?
Use Object Action client extensions. Register REST endpoints that Liferay calls when objects are created, updated, or deleted.