Broadleaf configures all of its entities to use InheritanceType.JOINED, because it provides the highest degree of flexibility and maintainability.
When we use this approach, any extension of the entity will be created as its own net new table.
This new table will only contain columns matching the new fields in the extension.
The primary key of this new table will itself just be a foreign key to the base table’s ID.
At the time any query is executed, Hibernate will automatically join the two tables to form the final result.
However, that means that we always need to have 1 record in the extended table for every record in the base table, otherwise, Hibernate will exclude it.
To fix this, usually a liquibase migration script is required: a simple SQL script to insert a record into the extended table for every record in the base table.
This is really powerful because it allows client extensions to be maintained independently of the base framework tables.