为什么我不能对Joda DateTime进行反序列化?

时间:2015-08-26 07:10:11

标签: java json spring jackson jodatime

当我们尝试映射存储过程的ResultSet时,我收到错误。

  

无法反序列化

结果setmapping类:

 @NamedNativeQueries({ @NamedNativeQuery( name = "callCurriculumSearchProc", query = "EXEC curriculumSearchProcedure :academy_id,:curriculum_id,:curriulum_abbr,:demand_forecasting," + ":event_custodian_id,:pre_post_flag,:reviewed_date,:is_active,:id", resultSetMapping = "curriculumSearchResult" ) }) @SqlResultSetMapping(name = "curriculumSearchResult", classes = { @ConstructorResult(targetClass = CurriculumSearchResult.class, columns = { @ColumnResult(name = "id" ,type = Long.class), @ColumnResult(name = "curriculum_name"), @ColumnResult(name = "cirriculum_abbr"), @ColumnResult(name = "academy_name"), @ColumnResult(name = "academy_short_Name"), @ColumnResult(name = "reviewed_date", type = DateTime.class), @ColumnResult(name = "custodian")}) })

@MappedSuperclass public class CurriculumSearchResult implements Serializable{

private static final long serialVersionUID = 1L;

@Column(name = "ID")
private Long id;

@Column(name = "curriculum_name")
private String curriculum_name;

@Column(name = "curriculum_abbr")
private String curriculum_abbr;

@Column(name = "academy_name")
private String academy_name;

@Column(name = "academy_short_Name")
private String academy_short_name;

@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
@JsonSerialize(using = CustomDateTimeSerializer.class)
@JsonDeserialize(using = CustomDateTimeDeserializer.class)
@Column(name = "reviewed_date")
private DateTime reviewed_date;

@Column(name = "custodian")
private String eventCustodian;

public CurriculumSearchResult (){

}
public CurriculumSearchResult(Long id, String curriculum_name, String curriculum_abbr, String academy_name, String academy_short_name, DateTime reviewed_date, String eventCustodian) { super(); this.id = id; this.curriculum_name = curriculum_name; this.curriculum_abbr = curriculum_abbr; this.academy_name = academy_name; this.academy_short_name = academy_short_name; this.reviewed_date = reviewed_date; this.eventCustodian = eventCustodian; }

public Long getId() {
    return id;
}

public void setId(Long id) {
    this.id = id;
}

public String getCurriculum_name() {
    return curriculum_name;
}

public void setCurriculum_name(String curriculum_name) {
    this.curriculum_name = curriculum_name;
}

public String getCurriculum_abbr() {
    return curriculum_abbr;
}

public void setCurriculum_abbr(String curriculum_abbr) {
    this.curriculum_abbr = curriculum_abbr;
}

public String getAcademy_name() {
    return academy_name;
}

public void setAcademy_name(String academy_name) {
    this.academy_name = academy_name;
}

public String getAcademy_short_name() {
    return academy_short_name;
}

public void setAcademy_short_name(String academy_short_name) {
    this.academy_short_name = academy_short_name;
}

public DateTime getReviewed_date() {
    return reviewed_date;
}

public void setReviewed_date(DateTime reviewed_date) {
    this.reviewed_date = reviewed_date;
}

public String getEventCustodian() {
    return eventCustodian;
}

public void setEventCustodian(String eventCustodian) {
    this.eventCustodian = eventCustodian;
}

@Override
    public int hashCode() {
        return Objects.hashCode(id);
    }

@Override
public String toString() {
    return "CurriculumSearchResult [id=" + id + ", curriculum_name="
            + curriculum_name + ", curriculum_abbr=" + curriculum_abbr
            + ", academy_name=" + academy_name + ", academy_short_name="
            + academy_short_name + ", reviewed_date=" + reviewed_date
            + ", eventCustodian=" + eventCustodian + "]";
}
} 

reviewed_date列中有值时,我收到此错误,但当值为null时,它会正常工作。

0 个答案:

没有答案