我有一个父实体和两个子实体。 ReportDetails是我的父实体,ReportBarChart和ReportPieChart是我的子实体。以上三个有一些共同点。 因此,在保存细节的同时,我在JPA中使用每个子类策略的表。 但是在设置父实体值之后,同时保持实体获得跟随错误。
INFO [stdout] (default task-66) Hibernate: select OVIMPLWZ.OV_RPT_SEQ.nextval from dummy
INFO [stdout] (default task-66) Hibernate: insert into OVIMPLWZ.OV_RPT (AUDIT_CRT_DATE, CHART_TYPE, CRT_USER, DSBRD_LINK, KPI_MASTER_KEY, PLANT_KEY, PUBLSH_FLDR, PUBLSH_IND, RPT_DESC, RPT_NAME, TNT_KEY, UPD_USER, RPT_KEY) values (?, 79, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
INFO [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] (default task-66) HHH000010: On release of batch it still contained JDBC statements
WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-66) SQL Error: -11252, SQLState: HY009
ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-66) SAP DBTech JDBC: Column index 13 was not found.
WARN [com.arjuna.ats.arjuna] (default task-66) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffffac103470:-51bf6313:563b07bd:e3b, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@192b3dcb >: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not insert: [com.rolta.oneviewmr.model.ReportPieChart]
我的实体
ReportDetails.java
@Entity
@Table(name="OV_RPT")
@Inheritance(strategy=InheritanceType.JOINED)
@DiscriminatorColumn(name="CHART_TYPE",
discriminatorType=DiscriminatorType.INTEGER)
@SequenceGenerator(name="OV_RPT_SEQ",sequenceName="OV_RPT_SEQ",
allocationSize=1)
public class ReportDetails extends ModelObject{
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="OV_RPT_SEQ")
@Column(name="RPT_KEY")
private Long reportKey;
@Column(name="RPT_NAME")
private String reportName;
@Column(name="RPT_DESC")
private String reportDescription;
@Column(name="KPI_MASTER_KEY")
private Long kpiMasterKey;
@Column(name="DSBRD_LINK")
private String dashboardLink;
@Column(name="PUBLSH_IND")
private String publishIndicator;
@Column(name="PUBLSH_FLDR")
private String publishFolder;
@Column(name="CHART_TYPE")
private Long chartType;
@Column(name="AUDIT_CRT_DATE")
private Timestamp auditCreateDate;
@Column(name="CRT_USER")
private String createdUser;
@Column(name="UPD_USER")
private String updatedUser;
@Column(name="TNT_KEY")
private Long tenantKey;
@Column(name="PLANT_KEY")
private Long plantKey;
// getteres and setters methods for the fields.
}
ReportPieChart.java
@Entity
@Table(name="OV_RPT_PIE_CHART")
@PrimaryKeyJoinColumn(name="RPT_KEY")
@DiscriminatorValue(value=AppConstants.REPORT_TYPE_PIE)
public class ReportPieChart extends ReportDetails{
/**
*
*/
private static final long serialVersionUID = 1L;
@Column(name="X_AXIS_VAL")
private String xAxisValue;
@Column(name="Y_AXIS_VAL")
private String yAxisValue;
@Column(name="AUDIT_CRT_DATE")
private Timestamp auditCreateDate;
@Column(name="AUDIT_UPD_DATE")
private Timestamp auditUpdateDate;
@Column(name="CRT_USER")
private String createdUser;
@Column(name="UPD_USER")
private String updateUser;
@Column(name="TNT_KEY")
private Long tntKey;
@Column(name="PLANT_KEY")
private Long plantKey;
// getteres and setters methods for the fields.
}
请帮助解决此问题。