Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Improved: Make ModelEntityChecker database-agnostic with dynamic size limits - #2732

Open
nmalin wants to merge 1 commit into
apache:trunkfrom
nmalin:improve-database-checker
Open

nmalin wants to merge 1 commit into
apache:trunkfrom
nmalin:improve-database-checker

Conversation

@nmalin

@nmalin nmalin commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Previously, when OFBiz started the entity engine, it called ModelEntityChecker to validate the data model quality. During this check, elements like field name length or column name length were compared against hardcoded values (30 for table/column names, 18 for index names). While this ensured OFBiz worked well across all supported databases, it was sometimes too restrictive for custom deployments using a specific database with higher limits.

This change removes all hardcoded values and replaces them with dynamic limits fetched from the Datasource configuration. This allows users to:

  • Override default values to match their database capabilities.
  • Avoid false-positive warnings when their database supports longer names.
  • Tailor validation rules to their environment without modifying the core.

Additionally, the code has been refactored for better maintainability:

  • Replace hardcoded size limits with dynamic values from Datasource config.
  • Refactor all warning messages to use String.format() for consistency.
  • Improve encapsulation by changing RW_ARRAY visibility from protected to private.
  • Use idiomatic Java methods (isEmpty(), Arrays.asList()).
  • Rename variables for clarity (ufields -> uniqueFields).

… limits

Previously, when OFBiz started the entity engine, it called ModelEntityChecker
to validate the data model quality. During this check, elements like field
name length or column name length were compared against hardcoded values
(30 for table/column names, 18 for index names). While this ensured OFBiz
worked well across all supported databases, it was sometimes too restrictive
for custom deployments using a specific database with higher limits.

This change removes all hardcoded values and replaces them with dynamic
limits fetched from the Datasource configuration. This allows users to:
- Override default values to match their database capabilities.
- Avoid false-positive warnings when their database supports longer names.
- Tailor validation rules to their environment without modifying the core.

Additionally, the code has been refactored for better maintainability:
- Replace hardcoded size limits with dynamic values from Datasource config.
- Refactor all warning messages to use String.format() for consistency.
- Improve encapsulation by changing RW_ARRAY visibility from protected to private.
- Use idiomatic Java methods (isEmpty(), Arrays.asList()).
- Rename variables for clarity (ufields -> uniqueFields).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant