私のエンティティの構造は次のとおりです。
@MappedSuperclass
public abstract class BaseEntity {
@Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqGenerator")
private Long id;
}
@MappedSuperclass
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@SequenceGenerator(name = "seqGenerator", sequenceName = "DICTIONARY_SEQ")
public abstract class Intermed extends BaseEntity {}
@Entity
public class MyEntity1 extends Intermed {}
@Entity
public class MyEntity2 extends Intermed {}
そして、私は次の例外を得ました:
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'sessionFactory' defined in class path resource [context/applicationContext.xml]:
Invocation of init method failed; nested exception is org.hibernate.AnnotationException: Unknown Id.generator: seqGenerator
Intermed クラスで @MappedSuperclass を @Entity に変更すると、すべて正常に動作します。@MappedSuperclass と @SequenceGenerator の使用に問題はありますか? それとも私は何かを逃したのですか?