Question regarding and possible small bug with @MappedSuperclass

This is intended to report a potentially small bug and to ask a related question.

In Studio, I created a mapped superclass extending StandardEntity. I also have a bunch of entities which extend that superclass. Everything seems to be working fine. I also created a listener for the superclass using Studio functionality and it successfully created the listener with a blank onBeforeInsert method which I filled in.

My question is whether there are any potential problems with this setup? My understanding is that in principle, listeners on mappedsuperclasses are allowed. I found one posting on this (jakarta ee - Entity listener on a @MappedSuperclass does not work? - Stack Overflow) which links to an EclipseLink bug report that seems to have been fixed. But even if it is allowed, are there any reasons you can see why it might not be a good idea?

The potential bug is as follows, assuming that listeners on mapped superclasses are in fact allowed. Studio did not automatically put the @Listener annotation on the superclass when I added the Listener. Previously whenever I added a Listener to an actual entity, Studio always added the @Listener annotation. This is not a particularly big deal because I just added the annotation myself and it works fine and I noticed it immediately. However, I can see it causing developer confusion if it is not noticed right away.

In CUBA, EntityListeners are allowed on a MappedSuperclass. We have implemented them differently from EclipseLink, so the possible bugs in EclipseLink are irrelevant.

When you create an entity listener in Studio, you can see the “Use for entities” list. It is filled automatically if you select a concrete entitiy in the “Entity type” field, and in this case these entities get the @Listeners annotation correctly. In case of selecting a mapped superclass in the “Entity type” field, you now have to add your entity in the list manually. Perhaps you are right and we should do the same as for concrete entity to avoid confusion.

:ticket: See the following issue in our bug tracker:

https://youtrack.cuba-platform.com/issue/STUDIO-3415