It rewrites parts of how the PolyglotListener injects Translatable into entities when they are loaded and/or updates are flushed to the database. IMHO it's less interference with ORM lifecycle methods. We can avoid keeping a list of all entities with translations in PolyglotListener, which helps with garbage collection.
Previously, it was not possible to use translations with entities from an inheritance hierarchy. Now, every class in the hierarchy can define its own @TranslationsCollection and its own translations class. The translations class should only contain fields present in the corresponding class in the inheritance tree. The @Locale annotation will be searched for on parent classes as well.
This PR contains the following improvements:
PolyglotListener
injectsTranslatable
into entities when they are loaded and/or updates are flushed to the database. IMHO it's less interference with ORM lifecycle methods. We can avoid keeping a list of all entities with translations inPolyglotListener
, which helps with garbage collection.@TranslationsCollection
and its own translations class. The translations class should only contain fields present in the corresponding class in the inheritance tree. The@Locale
annotation will be searched for on parent classes as well.