人脈通廣告系統搭建

HTTP Status 406 -
    @RequestMapping(value = "/queryList", produces = {"application/json;charset=UTF-8"}, method = RequestMethod.GET)
    @ResponseBody
    public List queryList(AdContent adContent,PageParam pageParam) {
        pageParam.setPageNum(1);
        pageParam.setPageSize(2);
        PageInfo<AdContent> queryListWithPage = adContentService.queryListWithPage(adContent, pageParam);
        return queryListWithPage.getList();
    }

把list數據內類型轉換成json缺乏依賴包
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.4.2</version>
		</dependency>
異常:java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp

數據庫字段:
`createDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '建立時間',
`updateDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '更新時間',

錯誤分析:
Datetimes with all-zero components (0000-00-00 ...) — These values can not be represented
關於全部Datetime類型由0組成的數據,這些值不能在java中被可靠的表示


解決方式:
設置爲convertToNull,用NULL值來代替這個日期類型
jdbc:MySQL://localhost/jiutong_ad?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull
相關文章
相關標籤/搜索