79271403

Date: 2024-12-11 10:51:11
Score: 1.5
Natty:
Report link

An example we used on production of a use of this class, is to add to entities transversal functionality.

We have an abstract @MappedSuperclass that is AuditableEntity that adds creation user, modification user, creation timestamp and modification timestamp to entities, and all entities that needs to be audited extend the mapped superclass, so it's those fields in the abstract mapped superclass are set and persisted.

A huge pitfall I saw in production that led to a total refractoring of the persistence code, was on a project where all persistent classes where parents and siblings of entities, when the project grew a little bit a single 50 items paged listing took hundreds of SELECTs by hibernate to be fullfiled.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • User mentioned (1): @MappedSuperclass
  • Low reputation (0.5):
Posted by: iagorubio