Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #2258 - Typeful Metadata #2270

Open
wants to merge 173 commits into
base: develop
Choose a base branch
from
Open

Issue #2258 - Typeful Metadata #2270

wants to merge 173 commits into from

Conversation

homedirectory
Copy link
Contributor

@homedirectory homedirectory commented Jun 10, 2024

Resolve #2258.

This PR should be merged together with corresponding PRs in TG applications and https://github.com/fieldenms/tg-libs/pull/27.

Summary of changes

There have been a number of breaking changes associated with the removal of EQL3 metadata and EQL2
metadata, therefore TG applications need to be adjusted accordingly.

Metadata:

  • EQL3 and EQL2 metadata have been removed and their usages replaced by Typeful Metadata
  • Stricter validation of property definitions during metadata generation: unsupported property types
    are detected early (in some cases an unsupported type is shown mercy and corresponding property is
    simply skipped).
  • Changes to Property Metadata:
    • Properties with a composite or a union entity type are classified according to their nature in
      the same way as other properties. This hadn't been the case with EQL3 metadata, which ignored
      the nature of such properties, instead forcing the caller to look at their sub-properties for
      this information.

Other changes:

  • Value range validation (from-to) is now supported for BigDecimal.
  • All generated proxy entity types now implement IProxyEntity.
  • Generated ID-only proxy entity types now implement IIdOnlyProxyEntity.
  • Test entity types were modified by replacing unsupported property types with supported ones (e.g.,
    Double by BigDecimal).

Future work

  • Encapsulate Hibernate type access in a standalone service. It should have the following API:

    Optional<?> hibernateType(PropertyMetadata property)
  • Encapsulate EqlTable access in a standalone service. It should have the following API:

    EqlTable eqlTable(Class<? extends AbstractEntity<?>> entityType)
  • Encapsulate TableStructForBatchInsertion access in a standalone service. It should have the following API:

    TableStructForBatchInsertion tableStructForBatchInsertion(Class<? extends AbstractEntity<?>> entityType)
  • Encapsulate database DDL generation in a standalone service. It should have the following API:

    List<String> generateDatabaseDdl(Dialect dialect)
  • Configure dependency injection and decouple IDomainMetadata from QuerySourceInfoProvider.

Nazar Chaykivskyy and others added 30 commits February 21, 2024 10:02
…ubpackage to be later turned into new implementation (based on EQL3 metadata).
sorted() was causing a runtime error due to StringBuffer and String not
being mutually comparable.
These predicates are preferred over "instanceof" statements.
…data

Injection of the metadata service is yet to be implemented.
…ies to generate metadata for property "version"

It is not clear why a more specific predicate (targeting only the
superclass) had been used, but the incosistencies it could result in
don't make a lot of sense (e.g., generated types based on
synthetic-based-on-persistent would lack metadata for "version").
…-on-persistent entity types

Consider the whole type hierarchy, not just the superclass.
…ut a DB table

During migration to Typeful Metadata the algorithm has been incorrecly
understood and table name existence became a strict constraint.
Note: Cache.get, if key is absent, caches the value returned by the
supplied loader, so there is no need to Cache.put it manually.
… behaviour

* Exclude plain properties of persistent entities (they were absent from
  EQL3 metadata).
* Correct computation of key member indices for entities with a simple
  key.
Given the following entities:

Entity E
    CompositeKeyMember
    property x: U
Union Entity U
    property y: E

Fetch model construction would get stuck in a cycle between them.
@homedirectory homedirectory requested a review from 01es June 10, 2024 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typeful Metadata
2 participants