在存Blob文件到數(shù)據(jù)庫時(shí),有人遇到過這個(gè)錯(cuò)誤嗎?
ERROR: HHH000099: an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session): org.hibernate.AssertionFailure: null id in Students entry (don't flush the Session after an exception occurs)
2017-08-22
找到原因了,是由于Students.hbm.xml文件中,我的主鍵生成策略使用了native,換成assigned就可以了。但原理還是不懂。直接原因是,使用了Blob類型,主鍵自增不好使了。tag一下,變強(qiáng)之后,要記得解釋這個(gè)問題。