1

I have one parent entity and two child entities. ReportDetails is my parent entity and ReportBarChart and ReportPieChart are my child entities. The above three share some common fields. So to while saving the details I'm using table per sub class strategy in JPA. But after setting the Parent entity values, while persisting the entity getting following error.

 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]

My entities are

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.
}

Please help to resolve this issue.

udaykiran.nalla
  • 109
  • 1
  • 15
  • perhaps there is a column in the db missing? because of the error "SAP DBTech JDBC: Column index 13 was not found." What is the error "SQL Error: -11252" ? – Si mo Nov 06 '15 at 07:41
  • But I'm able to insert data manually for the same insert statement. – udaykiran.nalla Nov 06 '15 at 08:12
  • ok, but what is the description for the db error? – Si mo Nov 06 '15 at 08:18
  • No idea. i didn't find any where. – udaykiran.nalla Nov 06 '15 at 08:39
  • which kind of database are you using? and please configure your log that you can see the the sql parameter values; http://www.mkyong.com/hibernate/how-to-display-hibernate-sql-parameter-values-log4j/ and post this log. perhaps there is a null value or something like that – Si mo Nov 06 '15 at 08:44
  • I'm using SAP Hana db. Even if null value set for a column its should insert. If there is any mandatory column its should throw a null value exception. but I'm setting values for them also. – udaykiran.nalla Nov 06 '15 at 08:50
  • hi, I found another thread. https://forum.hibernate.org/viewtopic.php?f=1&t=925915. perhaps this can help you .. ? I didn't found the errorcode, too. But here is the source where the exception is thrown http://libsapdbc-java.sourcearchive.com/documentation/4753/CallableStatementSapDB_8java-source.html – Si mo Nov 06 '15 at 09:06

0 Answers0