All posts
Liferay · 10 min read · Mar 5, 2026

Expando to Object migration: lessons learned from a real enterprise portal

Liferay Expando to Object migration

For years, Expando fields were the default answer whenever a business team requested additional data in Liferay. Need an ERP customer identifier? Add an Expando. Need a Factusol integration field? Add an Expando. Need another custom flag? Add another Expando. Over time, the portal accumulated hundreds of custom fields spread across users, organizations, accounts, and custom entities. What initially looked like a simple migration to Liferay Objects quickly turned into a much larger modernization effort.

Finding every dependency first

The first challenge was discovering where Expando data was actually being used. The obvious places were custom modules and JSPs, but those were only part of the story. We found Expando values referenced inside SQL views, reporting databases, scheduled jobs, REST integrations, Groovy scripts, and external BI tools. Some reports were directly querying Expando tables instead of using service APIs. Before migrating anything, we spent significant time identifying every dependency. The lesson was simple: if you only migrate the data model, you have not completed the migration.

Reporting systems coupled to internals

One surprising issue involved reporting systems. Several SQL views joined directly against ExpandoValue and ExpandoColumn tables. These reports had been running for years and nobody remembered they depended on Expando internals. Replacing Expando with Objects meant every report had to be updated. Rather than continuing the pattern of querying internal Liferay tables, we created dedicated views exposing the required business data. This reduced coupling and made future migrations much easier.

sql
-- Before: report coupled to Expando internals
SELECT u.userId, ev.data_ AS erpCustomerId
FROM User_ u
JOIN ExpandoValue ev ON ev.classPK = u.userId
JOIN ExpandoColumn ec ON ec.columnId = ev.columnId
WHERE ec.name = 'erpCustomerId';

-- After: report reads a stable, purpose-built view
SELECT userId, erpCustomerId
FROM vw_customer_identifiers;
Decoupling reports from ExpandoValue/ExpandoColumn by exposing a dedicated view.

Tracking partially migrated data

Another challenge was handling partially migrated data. Some records already contained valid Expando values, while others were empty. We needed a way to distinguish between records that had been reviewed and records that still required migration. Instead of relying solely on the business value itself, we introduced configuration indicators that explicitly marked whether a field had been processed. This avoided ambiguity between a genuinely empty value and a value that had never been migrated.

Hardcoded identifiers became another source of technical debt. Throughout the system, SQL queries referenced specific Expando column IDs, class names, and site identifiers. These values worked until environments diverged. During the migration, we replaced hardcoded references with business-friendly identifiers such as field names, object definitions, friendly URLs, and template names. The resulting code became far more portable across development, staging, and production environments.

Performance and data quality wins

Performance was also an important consideration. Many legacy queries performed multiple joins against Expando tables to retrieve a handful of fields. As data volume increased, these queries became increasingly expensive. After migrating to Objects and creating purpose-built reporting views, query complexity dropped significantly. The migration was not only a functional improvement but also a performance optimization.

Data quality issues surfaced throughout the project. Expando fields often lacked validation because they were added quickly to satisfy business requirements. We encountered inconsistent formats, missing values, duplicate identifiers, and fields that had changed meaning over time. Migrating to Objects provided an opportunity to define proper schemas, validations, and relationships. Cleaning the data required additional effort, but it prevented long-term operational problems.

Phased migration over big-bang

One of the biggest mistakes teams can make is attempting a big-bang migration. We chose a phased approach instead. Existing functionality continued reading Expando data while new implementations began using Objects. During the transition period, synchronization logic ensured both sources remained consistent. Once confidence increased and dependencies were removed, Expando usage was gradually retired. This strategy reduced risk and avoided large-scale disruptions.

The migration also highlighted the importance of preserving business logic. It is easy to focus on moving data from one structure to another, but users care about outcomes, not storage mechanisms. Every report, integration, workflow, and scheduled process had to continue producing identical results after migration. Extensive validation was required to confirm that behavior remained unchanged even though the underlying implementation was completely different.

What the migration really was

Looking back, the project was less about replacing Expando and more about modernizing years of accumulated customizations. Liferay Objects provided a cleaner and more maintainable foundation, but the real value came from eliminating hidden dependencies, reducing technical debt, improving reporting architecture, and creating a more sustainable data model. If your portal has relied heavily on Expando fields for years, expect the migration to be an architectural exercise rather than a simple data conversion project.

Contact

Let’s connect

Have a Liferay or Backend project you’d like to talk through? Fill in the form and I’ll get back to you.

Book Calendar