同時節省持續對象到數據庫波紋管我得到一個例外是代碼庫模型:例外執行批處理更新在休眠/ ORACLE /插入
@Entity
@Table(name = "customer_data")
public class BsslpCustomerInfo {
@Id
@Column(name = "id", length = 10)
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@Column(name = "service_Id", length = 50, unique = true, nullable = false)
private String serviceId;
@Column(name = "quarter", length = 255, nullable = false)
private String quarter;
@Column(name = "year")
private int year;
@Column(name = "activated_Customer_Name")
private String activatedCustomerName;
@Column(name = "deactivated_Customer_Name")
private String deactivatedCustomerName;
@Column(name = "quarter_Start_Date")
private String quarterStartDate;
@Column(name = "quarter_End_Date")
private String quarterEndDate;
public String getServiceId() {
return serviceId;
}
public void setServiceId(String serviceId) {
this.serviceId = serviceId;
}
public String getQuarter() {
return quarter;
}
public void setQuarter(String quarter) {
this.quarter = quarter;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public String getActivatedCustomerName() {
return activatedCustomerName;
}
public void setActivatedCustomerName(String activatedCustomerName) {
this.activatedCustomerName = activatedCustomerName;
}
public String getDeactivatedCustomerName() {
return deactivatedCustomerName;
}
public void setDeactivatedCustomerName(String deactivatedCustomerName) {
this.deactivatedCustomerName = deactivatedCustomerName;
}
public String getQuarterStartDate() {
return quarterStartDate;
}
public void setQuarterStartDate(String quarterStartDate) {
this.quarterStartDate = quarterStartDate;
}
public String getQuarterEndDate() {
return quarterEndDate;
}
public void setQuarterEndDate(String quarterEndDate) {
this.quarterEndDate = quarterEndDate;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
...這是「控制器」的代碼:
for (BsslpParty bsslp : data) {
Date activationDate = sdf.parse(bsslp.getAssocStartDate());
Date deactivationDate = sdf.parse(bsslp.getAssocEndDate());
if(activationDate.compareTo(startDate)>=0 && activationDate.compareTo(endDate)<=0){
activeCount++;
BsslpCustomerInfo bsslpCustomerInfo = new BsslpCustomerInfo();
bsslpCustomerInfo.setServiceId(bsslp.getBsslpName());
bsslpCustomerInfo.setActivatedCustomerName(bsslp.getEntitledPartyName());
bsslpCustomerInfo.setQuarter(quarterDateRange.getStartdate());
bsslpCustomerInfo.setYear(quarterDateRange.getFinYear());
bsslpCustomerInfo.setQuarterStartDate(quarterDateRange.getStartdate());
bsslpCustomerInfo.setQuarterEndDate(quarterDateRange.getEndDate());
listOfActDeActCust.add(bsslpCustomerInfo);
}
usageMetricschartService.saveAllCustomerData(listOfActDeActCust);
}
「服務」 實現:
@Override
@Transactional
public void saveAllCustomerData(List<BsslpCustomerInfo> customersData) {
// TODO Auto-generated method stub
for (BsslpCustomerInfo bsslpCustomerInfo : customersData) {
usageMetricsCustomersRepository.save(bsslpCustomerInfo);
}
}
它拋出一個錯誤,如:
java.sql.BatchUpdateException:ORA-01722:無效數字
oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343) org.springframework.dao.InvalidDataAccessResourceUsageException:不能執行批處理; SQL [insert into customer_data (activated_Customer_Name,deactivated_Customer_Name,quarter, quarter_End_Date,quarter_Start_Date,service_Id,year,id)values(?, ?,?,?,?,?,?,?)]嵌套的例外是 org.hibernate.exception.SQLGrammarException:無法執行批處理
我在所有可能的方式可能不知道這一點嘗試;任何人都可以請幫助我嗎?