//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;
}