文章詳情頁
mysql使用hiberna插入datetime值
瀏覽:98日期:2022-06-18 15:49:54
問題描述
create_time datetime DEFAULT NULL COMMENT ’批次創建時間’update_time datetime DEFAULT NULL COMMENT ’最后更新時間’
record.setCreateTime(new Date());record.setUpdateTime(new Date());
使用hibernate保存record對象,update_time的值保存到數據庫了,但是create_time一直為空,為什么?
問題解答
回答1:設置默認值為當前時間create_time datetime DEFAULT CURRENT_TIMESTAMP COMMENT ’批次創建時間’或者create_time timestamp DEFAULT CURRENT_TIMESTAMP COMMENT ’批次創建時間’
相關文章:
1. 關docker hub上有些鏡像的tag被標記““This image has vulnerabilities””2. Span標簽3. css - 求推薦適用于vue2的框架 像bootstrap這種類型的4. docker-machine添加一個已有的docker主機問題5. java - Collections類里的swap函數,源碼為什么要新定義一個final的List型變量l指向傳入的list?6. css - 關于div自適應問題,大家看圖吧,說不清7. android新手一枚,android使用httclient獲取服務器端數據失敗,但是用java工程運行就可以成功獲取。8. angular.js使用$resource服務把數據存入mongodb的問題。9. redis啟動有問題?10. SessionNotFoundException:會話ID為null。調用quit()后使用WebDriver嗎?(硒)
排行榜
