映射hibernate错误

时间:2017-12-12 10:08:48

标签: java mapping jackson-databind

我正在尝试映射一个hibernate项目,但是我收到了这个错误:

  

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

头等舱:

@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
   ) ;

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

提前谢谢!

0 个答案:

没有答案