mention dynamic models and Envers

This commit is contained in:
Gavin 2023-05-17 20:56:42 +02:00
parent eb21b1e052
commit 23de8a5e5d
1 changed files with 16 additions and 0 deletions

View File

@ -23,6 +23,22 @@ An entity usually has associations to other entities.
Typically, an association between two entities maps to a foreign key in one of the database tables.
A group of mutually associated entities is often called a _domain model_, though _data model_ is also a perfectly good term.
."Dynamic" models
****
:maps: {userGuideBase}#dynamic-model
:envers: https://hibernate.org/orm/envers/
We love representing entities as classes because the classes give us a _type-safe_ model of our data.
But actually, not every entity needs to be a Java class.
Hibernate also has the ability to represent entities as detyped instances of `java.util.Map`, and associations between entities as maps "containing" other maps.
This must sound like a sort-of weird feature for a project that places so much importance on type-safety.
But actually, this is a useful capability for a very particular sort of generic code.
The canonical demonstration of this is {envers}[Hibernate Envers], which is a great auditing/versioning system for programs that use Hibernate.
Envers makes use of maps to represent a _versioned model_ of the data.
You can find more information in the {maps}[User Guide], if you're curious.
****
[[entity-clases]]
=== Entity classes