Do you have a common base class for Hibernate entities?

后端 未结 5 581
面向向阳花
面向向阳花 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:22

    I wouldn't hesitate to use a common base class, after all that's the point of O/R mapping.

    I use common base classes, too, but only if the entities share at least some common properties. I won't use it, if the ID is the only common property. Until now I did not encounter any problems.

提交回复
热议问题