我正在尝试将JSON插入“ ORMLITE”数据库中,但出现错误。
我的json是:
{
"employee_details": [
{
"bARNID": "1",
"bIRTHDATE": "10.10.2015",
"dELIVERYDATE": "10.10.2015",
"govNR": "AT000000000001",
"nAME": "Name1",
"sMARTBOW": "A11A"
},
{
"bARNID": "2",
"bIRTHDATE": "11.10.2015",
"dELIVERYDATE": "11.10.2015",
"govNR": "DE000000000002",
"nAME": "Name2",
"sMARTBOW": "B22B"
}
]
}
我创建的Model类是:
@DatabaseTable(tableName = "employee_details")
public class Master implements Serializable {
@DatabaseField(columnName = "employee_details")
@Expose
private List<Emplyeedetail> emplyeedetails = new ArrayList<Emplyeedetail>();
public List<Emplyeedetail> getEmplyeedetails() {
return emplyeedetails;
}
public void setEmplyeedetails(List<Emplyeedetail> emplyeedetails) {
this.emplyeedetails = emplyeedetails;
}
}
另一个Model类是:
@DatabaseTable(tableName = "emplyeedetail")
public class Emplyeedetail {
public Emplyeedetail(String govNR, String sMARTBOW,String bIRTHDATE,String nAME,String bARNID ,String dELIVERYDATE ) {
this.govNR = govNR;
this.sMARTBOW = sMARTBOW;
this.bIRTHDATE = bIRTHDATE;
this.nAME = nAME;
this.bARNID = bARNID;
this.dELIVERYDATE = dELIVERYDATE;
}
public Emplyeedetail() {
}
@DatabaseField(columnName = "GovNR")
private String govNR;
@DatabaseField(columnName = "SMARTBOW")
private String sMARTBOW;
@DatabaseField(columnName = "BIRTHDATE")
private String bIRTHDATE;
@DatabaseField(columnName = "NAME")
private String nAME;
@DatabaseField(columnName = "BARNID")
private String bARNID;
@DatabaseField(columnName = "DELIVERYDATE")
private String dELIVERYDATE;
public String getBARNID() {
return bARNID;
}
public void setBARNID(String bARNID) {
this.bARNID = bARNID;
}
public String getBIRTHDATE() {
return bIRTHDATE;
}
public void setBIRTHDATE(String bIRTHDATE) {
this.bIRTHDATE = bIRTHDATE;
}
public String getDELIVERYDATE() {
return dELIVERYDATE;
}
public void setDELIVERYDATE(String dELIVERYDATE) {
this.dELIVERYDATE = dELIVERYDATE;
}
public String getGovNR() {
return govNR;
}
public void setGovNR(String govNR) {
this.govNR = govNR;
}
public String getNAME() {
return nAME;
}
public void setNAME(String nAME) {
this.nAME = nAME;
}
public String getSMARTBOW() {
return sMARTBOW;
}
public void setSMARTBOW(String sMARTBOW) {
this.sMARTBOW = sMARTBOW;
}
@Override
public String toString() {
return "Emplyeedetail{" +
"bARNID='" + bARNID + '\'' +
", bIRTHDATE='" + bIRTHDATE + '\'' +
", dELIVERYDATE='" + dELIVERYDATE + '\'' +
", govNR='" + govNR + '\'' +
", nAME='" + nAME + '\'' +
", sMARTBOW='" + sMARTBOW + '\'' +
'}';
}
}
我得到的错误是:
java.lang.IllegalArgumentException:ORMLite不知道如何存储 字段emplyeedetails的接口java.util.List。使用其他课程 或自定义的持久性。