課程
/后端開發
/Java
/Hibernate初探之一對多映射
getStudent是得到一個set集合,實體類中沒有創建,直接獲取出現空指針異常。您是如何解決的?
我是先創建Set集合將Student對象添加到里面,才將數據插入數據庫。
2017-10-14
源自:Hibernate初探之一對多映射 2-6
正在回答
?public?Set<Student>?getStudents()?{ ????????return?this.students; ????} ?public?void?setStudents(Set<Student>?students)?{ ????????this.students?=?students; ????}
Grade實體類中需要創建set<Student>的get/set方法
qq_似花非花_1
舉報
Hibernate中一對多關聯映射配置,以及cascade和inverse屬性作用
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2017-10-14
Grade實體類中需要創建set<Student>的get/set方法