Hibernate SYN One-to-Many Description

xiaoxiao2021-03-06  21

In one-to-man relationship, it is when the father and child relationship are saved at the same time, it will be reported: java.lang.nullpointersRext At com.kaoyanhelper.logic.testhibernate.Main (Testhibernate.java: 39)

Solution:

Base parent.java file: Find private java.util.set _childs;

Haha, actually did not initialize, that is in Parent.getChilds (). Add (child); Can I send an empty pointer error?

Just change to private java.util.set_Childs = new hashset ();

HEHE, of course, import .. Don't forget it.

In addition, everyone has a good way to tell me .. THANKS.

转载请注明原文地址:https://www.9cbs.com/read-39543.html

New Post(0)