I have a parent class of user with @mappedsuperclass annotation and classes of merchant, buyer, etc I want to make a role class and annotate @manytomany in that class to the parent class But this is not possible for me because it is not an entity. Is there another way that I can create a manytomany relationship to the parent class without creating a table of it in the DB?
I saw in previous answers of people that they changed to the @inheritance annotation but this creates a table of the parent class for me, which I don't want.
you can use EmbeddedId and Embeddable class like below and made the relation by the subclasses: