0

我正在尝试映射一个休眠项目,但出现此错误:

javax.servlet.ServletException:org.glassfish.jersey.server.ContainerException:com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException:无法识别的字段“编程”

一级:

@Entity
@Table(name = "T_JOB_PROGRAMMATION")
@SequenceGenerator(name = "seqJobProgrammation", sequenceName = "SEQ_JOB_PROGRAMMATION", initialValue = 1,
        allocationSize = 1)
@Getter
@Setter
public class JobProgrammation
        implements
        Comparable<JobProgrammation> {

    @Id
    @GeneratedValue(generator = "seqJobProgrammation", strategy = GenerationType.SEQUENCE)
    @Column(name = "T_JOB_PROGRAMMATION_ID")
    private int id;

    @Column(name = "NOM_JOB_REF_BEAN")
    private String nomJobRefBean;

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinColumn(name = "T_JOB_PROGRAMMATION_ID", nullable = false)
    private Set<Programmation> prog;


}

二等:

@Entity
@Table(name = "T_PROGRAMMATION")
@SequenceGenerator(name = "seqProgrammation", sequenceName = "SEQ_PROGRAMMATION", initialValue = 1,
        allocationSize = 1)
@Getter
@Setter
public class Programmation {
    public enum EtatJob {
        PAUSE, ENCOURS, UNEFOIS,
    }

    @Id
    @GeneratedValue(generator = "seqProgrammation", strategy = GenerationType.SEQUENCE)
    @Column(name = "T_PROGRAMMATION_ID")
    private int id;

    @Column(name = "ETAT")
    @Enumerated(EnumType.STRING)
    private EtatJob etat;


}

我不能使用属性 uptade/create 来动态创建/更新项目(我担心的企业)所以我自己创建了表:

  CREATE TABLE "DEXTER"."T_JOB_PROGRAMMATION" 
   (    "T_JOB_PROGRAMMATION_ID" NUMBER(10,0) NOT NULL ENABLE, 
    "NOM_JOB_REF_BEAN" VARCHAR2(50) NOT NULL ENABLE, 
     CONSTRAINT "PK_JOB_PROGRAMMATION" PRIMARY KEY ("T_JOB_PROGRAMMATION_ID")
  USING INDEX  ENABLE, 
     CONSTRAINT "FK_JP_PLUGIN" FOREIGN KEY ("T_PLUGIN_ID")
      REFERENCES "DEXTER"."T_PLUGIN" ("T_PLUGIN_ID") ENABLE
   ) ;

  CREATE TABLE "DEXTER"."T_PROGRAMMATION" 
   (    "T_PROGRAMMATION_ID" NUMBER(10,0), 
    "ETAT" VARCHAR2(10) DEFAULT 'ENCOURS', 
    "T_JOB_PROGRAMMATION_ID" NUMBER(10,0), 
     CONSTRAINT "PK_PROGRAMMATION" PRIMARY KEY ("T_PROGRAMMATION_ID")
  USING INDEX  ENABLE, 
     CONSTRAINT "FK_P_JP" FOREIGN KEY ("T_JOB_PROGRAMMATION_ID")
      REFERENCES "DEXTER"."T_JOB_PROGRAMMATION" ("T_JOB_PROGRAMMATION_ID") ON DELETE CASCADE ENABLE
   ) ;

看起来映射中存在问题,有什么想法吗?

先感谢您 !

4

0 回答 0