开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜