org.hibernate.mapping.SingleTableSubclass无法转换为org.hibernate.mapping.RootClass

时间:2019-05-08 12:47:56

标签: java

//Passing.java

    @Entity
    @Table(name = "PASSING")
    @DiscriminatorColumn(name = "PASSING_TYPE", discriminatorType = DiscriminatorType.STRING)
    @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
    @DiscriminatorValue("P")
    @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
    public class Passing {

      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(name = "PASSING_ID")
      private Long passingId;

      @Column(name = "AVG_SPEED")
      private Float avgTrainSpeed;
}

//WPDPassing.java

@Entity
//@Table(name="PASSING")
@SecondaryTable(name="WPD_PASSING", pkJoinColumns = @PrimaryKeyJoinColumn(name = "PASSING_ID", referencedColumnName = "WPD_PASSING_ID"))
@DiscriminatorValue("WPD")
public class WPDPassing extends Passing{

@Column(table = "WPD_PASSING", name="TRAIN_STATUS_CODE")
private Integer trainStatusCode;

}

0 个答案:

没有答案