0

spring-boot-starter-data-jpa で Spring-Boot 1.5.10 を使用しています。ステージング テーブルとプロダクション テーブルがありますが、どちらもテーブル名が異なるだけで構造は同じです。列は次のとおりです。

  • compKey1
  • compKey2
  • compKey3
  • コーラ
  • col_B
  • col_c

次のエラーが表示されます:

原因: org.hibernate.AnnotationException: エンティティの識別子が指定されていません: com.foo.bar.StagingTbl

次のように定義されたクラスの複合主キーがあります。

@Embeddable
public class MyId implements Serializable {

        private static final long serialVersionUID = -99999999L;

        protected String compKey1;
        protected String compKey2;
        protected String compKey3;

       // setters/getters
}

my Abstract class:

        @MappedSuperclass
        public abstract class MyAbstractClass implements Serializable {

            protected static final long serialVersionUID = 7749572933971565230L;
            protected MyId myId;
            protected int col_A;
            protected Date col_B;
            protected String col_C

            public MyAbstractClass (String compKey1, String compKey2, String compKey3) {
              super();
              this.myId = new MyId(compKey1, compKey2, compKey3);
           }

            @EmbeddedId
            public MyId myId() {
                return myId;
            }
            public void setMyId(MyId myId) {
                this.myId= myId;
            }
          // getters/setters for other properties
}

私の具体的なクラス:

@Entity
@Table(name = "STG_TABLE" , schema="MYSCEMA")
public class StagingTbl extends MyAbstractClass implements Serializable {

}

識別子は、拡張している MyAbstractClass から取得する必要があります。私は明らかに何かばかげたことを見逃しています。前もって感謝します。

4

1 に答える 1