0
爲了將對象保留到postgres數據庫,我使用的是一個註釋類而不是xml文件。以下是使用的模板類。休眠:插入查詢不包含值
import java.sql.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
@Entity
@Table(name = "ABCD", catalog = "XYZ", uniqueConstraints = {
@UniqueConstraint(columnNames = "FILE_REF_NO") })
public class MCT112_InputFAT implements java.io.Serializable {
@Id
@Column(name = "FILE_REF_NO", unique = true, nullable = false)
private String fileRefNo;
@Column(name = "FILE_NAME")
private String fileName;
@Column(name = "FILE_DATE")
private Date fileDate;
@Column(name = "FILE_PROCESSED_DATE")
private Date processedDate;
@Column(name = "PROCESSED_STATUS")
private Boolean processedStatus;
@Column(name = "FILLER1")
private Date filler1;
@Column(name = "FILLER2")
private String filler2;
@Column(name = "FILLER3")
private String filler3;
@Column(name = "FILLER4")
private Integer filler4;
@Column(name = "FILLER5")
private Integer filler5;
public MCT112_InputFAT() {
}
public MCT112_InputFAT(String fileRefNo, String fileName, Date fileDate, Date processedDate,
Boolean processedStatus, Date filler1, String filler2, String filler3, Integer filler4, Integer filler5) {
super();
this.fileRefNo = fileRefNo;
this.fileName = fileName;
this.fileDate = fileDate;
this.processedDate = processedDate;
this.processedStatus = processedStatus;
this.filler1 = filler1;
this.filler2 = filler2;
this.filler3 = filler3;
this.filler4 = filler4;
this.filler5 = filler5;
}
public String getFileRefNo() {
return fileRefNo;
}
public void setFileRefNo(String fileRefNo) {
this.fileRefNo = fileRefNo;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Date getFileDate() {
return fileDate;
}
public void setFileDate(Date fileDate) {
this.fileDate = fileDate;
}
public Date getProcessedDate() {
return processedDate;
}
public void setProcessedDate(Date processedDate) {
this.processedDate = processedDate;
}
public Boolean getProcessedStatus() {
return processedStatus;
}
public void setProcessedStatus(Boolean processedStatus) {
this.processedStatus = processedStatus;
}
public Date getFiller1() {
return filler1;
}
public void setFiller1(Date filler1) {
this.filler1 = filler1;
}
public String getFiller2() {
return filler2;
}
public void setFiller2(String filler2) {
this.filler2 = filler2;
}
public String getFiller3() {
return filler3;
}
public void setFiller3(String filler3) {
this.filler3 = filler3;
}
public Integer getFiller4() {
return filler4;
}
public void setFiller4(Integer filler4) {
this.filler4 = filler4;
}
public Integer getFiller5() {
return filler5;
}
public void setFiller5(Integer filler5) {
this.filler5 = filler5;
}
}`
但是,運行值在SQL字符串中填充爲空,如下所示。
insert into XYZ.ABCD(FILE_NAME, FILE_DATE, FILE_PROCESSED_DATE, PROCESSED_STATUS, FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, FILE_REF_NO) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
有沒有人知道這裏有什麼問題。