Hibernate mapping with abstract parent class

I have an abstract class containing several fields that are inherited by numerous child classes.

Child classes have their own fields, not just those inherited by this parent abstract class.

How do I map these attributes coming from the parent abstract class to a hibernation mapping or hibernation mapping file to save them to the database?

Each child class has its own table.

+3
source share
1 answer

Using annotations, you can add this to your abstract class:

@MappedSuperclass
public abstract class AbstractEntity {
    ...

And then map the fields in this class as usual.

+4
source

All Articles