課程
/后端開發
/Java
/基于SSH實現員工管理系統之案例實現篇
上面這樣寫在保存時不能添加部門的id
2017-02-18
源自:基于SSH實現員工管理系統之案例實現篇 4-2
正在回答
還是得靠自己,laozi告訴你們正解。
Employee中的Department成員變量,在使用ModelDriven之前,必須要Department department = new Department();因為沒有實例化,所以無法對department.did賦值。
解決方法:
在Employee中添加構造方法
public Employee(
????department = new Department();
)
就是在用之前實例化,就可以了。老師挖的坑。。
請問保存部門的問題解決了嗎?我現在也遇到了這個問題
puikiri
問題解決了嗎?rg.springframework.dao.DataIntegrityViolationException: could not insert: [com.muke.employee.domain.Employee]; SQL [insert into employee (ename, sex, birthday, joinDay, eno, username, password, dno) values (?, ?, ?, ?, ?, ?, ?, ?)]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not insert: [com.muke.employee.domain.Employee]
ID在數據庫中設的是主鍵,是自動增長的
舉報
SSH框架整合案例之實現篇,手把手帶你實現員工管理系統
2 回答員工中添加部門和修改部門出錯
1 回答添加部門的時候,參數對不上
4 回答為什么我的不管更新還是添加員工,外鍵的部門ID都是空白的!
1 回答添加員工時跳轉登錄頁面
1 回答保存新添加部門后的bug
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2018-07-08
還是得靠自己,laozi告訴你們正解。
Employee中的Department成員變量,在使用ModelDriven之前,必須要Department department = new Department();因為沒有實例化,所以無法對department.did賦值。
解決方法:
在Employee中添加構造方法
public Employee(
????department = new Department();
)
就是在用之前實例化,就可以了。老師挖的坑。。
2017-08-14
請問保存部門的問題解決了嗎?我現在也遇到了這個問題
2017-03-16
問題解決了嗎?rg.springframework.dao.DataIntegrityViolationException: could not insert: [com.muke.employee.domain.Employee]; SQL [insert into employee (ename, sex, birthday, joinDay, eno, username, password, dno) values (?, ?, ?, ?, ?, ?, ?, ?)]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not insert: [com.muke.employee.domain.Employee]
2017-03-08
ID在數據庫中設的是主鍵,是自動增長的