异常1:not-null property references a null or transient value
解决方法:将“一对多”关系中的“一”方,not-null设置为false
异常2:org.hibernate.TransientObjectException: object references an unsaved transient instance
解决方法:cascade="save-update,persist"
异常3:org.hibernate.QueryException: could not resolve property
解决方法:"from Category category where category.userID = :userID"修改为"from Category category where userID = :userID"或者"from Category category where category.user.id = :userID"
异常4:could not initialize proxy - the owning Session was closed
解决方法:设置lazy为false
解决方法:将“一对多”关系中的“一”方,not-null设置为false
异常2:org.hibernate.TransientObjectException: object references an unsaved transient instance
解决方法:cascade="save-update,persist"
异常3:org.hibernate.QueryException: could not resolve property
解决方法:"from Category category where category.userID = :userID"修改为"from Category category where userID = :userID"或者"from Category category where category.user.id = :userID"
异常4:could not initialize proxy - the owning Session was closed
解决方法:设置lazy为false