為什么老師的可以,我的就不可以更新呢?
org.springframework.dao.DuplicateKeyException:?
### Error updating database. ?Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '東苑' for key 'UK_AREA'
### The error may involve com.aochuang.dao.AreaDao.updateArea-Inline
### The error occurred while setting parameters
### SQL: UPDATE ?tb_area ? ? ? ? ?SET area_name=?, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?last_edit_time = ?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '東苑' for key 'UK_AREA'
; ]; Duplicate entry '東苑' for key 'UK_AREA'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '東苑' for key 'UK_AREA'
2018-11-20
添加的字段在數據庫中是唯一字段(UNIQUE KEY),添加的數據再數據庫中已經存在了,所以會報這個問題。
2018-10-01
對呀? 你直接在測試那里new Date對象進去就行啦?
2018-10-01
你直接在Sercvice層那里new一個Date對象來填入這個屬性