Hi everyone,
I’m working on a modular Jmix project and need some advice on advanced entity replacement.
Project structure:
- I have a main application: Project C
- It depends on Addon A, which defines a base entity
ACity
- It also depends on Addon B, which itself depends on Addon A, and replaces
ACity
withBCity
using@ReplaceEntity(ACity.class)
Now in Project C, I need to replace BCity
with my own version CCity
, while retaining all fields and behavior from both ACity
and BCity
.
The Problem:
When I try to define CCity
as @ReplaceEntity(BCity.class)
, I encounter issues during build or runtime
It seems like Jmix doesn’t support cascading @ReplaceEntity
annotations, i.e., replacing something that’s already a replacement.
My Questions:
- Is there a supported way to override an entity that was already overridden in an addon?
- Can I somehow build a proper inheritance chain
ACity → BCity → CCity
that Jmix can work with? - Are there alternative patterns for this scenario — e.g. composition over inheritance, entity extension, or some metadata trick?
- Are there any best practices for designing entities in addon layers where this type of re-replacement might be needed later?
I appreciate any guidance, patterns, or real-world experience with this type of setup.
Thanks in advance!