MappedSuperclass - Change SequenceGenerator in Subclass

后端 未结 4 1886
暖寄归人
暖寄归人 2020-11-29 07:07

I\'m using JPA2 with Hibernate and try to introduce a common base class for my entities. So far it looks like that:

@MappedSuperclass
public abstract class B         


        
4条回答
  •  粉色の甜心
    2020-11-29 07:52

    In JPA that cannot be done with annotations. Annotation itself cannot be overridden. Entity inherits all the mapping information from MappedSuperClass. There is only two annotations that can be used to redefine mappings inherited from mapped superClass:

    1. AttributeOverride to override column mappings and
    2. AssociationOverride to override join columns / table.

    Neither of them helps with GeneratedValue.

提交回复
热议问题