MappedSuperClass in app component


ParentEntity is a class annotated with @MappedSuperClass with attribute “name”. The class is defined in app component X.
ChildEntity is a subclass in application Y which add an attribute “description”. Application Y has an addon (app component X).

Creating a new instance of ChildEntity via UI generate an exception because attribute name isn’t valued in the insert query.

After some search, I see that the call to .getAttributeValueFromObject() in AbstractDirectMapping.writeFromObjectIntoRow() return null. Before that, attribute is correctly valued.

Is it correct ? Why ?

UPDATE: I realize that parent and child entities are each in a separate persistence unit. Is it good ?

Regards, Stef.

CUBA 7.2.15


I think the reason is because mappedsuperclass are not enhanced when there is no subclass in the same all component. See this comment from konstantin back then: 6.3.RC1 - MappedSuperclass in Application Component - Studio error - #4 от пользователя krivopustov

The solution is to create a dummy entity and remove it when building the jar.


1 Like

Thank you, Mario.

I’m struggling for excluding this Dummy class. Gradle doc isn’t very helpful. How did you do with CUBA, please ?