Do you have a common base class for Hibernate entities?

后端 未结 5 505
面向向阳花
面向向阳花 2021-02-01 05:51

Do you have a common base class for Hibernate entities, i.e. a MappedSuperclass with id, version and other common properties? Are there any drawbacks?

Example:



        
5条回答
  •  佛祖请我去吃肉
    2021-02-01 06:34

    This works fine for us. As well as the ID and creation date, we also have a modified date. We also have an intermediate TaggedBaseEntity that implements a Taggable interface, because some of our web application's entities have tags, like questions on Stack Overflow.

提交回复
热议问题