Hibernate mapping with abstract parent class
I have an abstract class holding a number of fields which are inherited by numerous chil开发者_C百科d classes.
Child classes have their own fields as well not just the ones inherited by this parent abstract class.
How do I map these attributes coming from parent abstract class to hibernate mapping file or with hibernate annotations, to save them in the database?
Each child class has its own table.
Using annotations you can add this to your abstract class:
@MappedSuperclass
public abstract class AbstractEntity {
...
And then map the fields in that class as you normally would.
精彩评论