org.hibernate.exception.GenericJDBCException

    剛剛開始接觸Hibernate編程,第一次寫個小項目,就遇到這個問題,弄明白怎麼回事後,記錄下來了!

  錯誤:

    org.hibernate.exception.GenericJDBCException: could not insert: [vo.User]

    at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)

    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)

    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)

    at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:40)

    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2093)

錯誤原因:我在數據庫設計時候,沒有給ID設置爲自增,做添加操作時,也沒有給其賦值,所以才插入異常。

 

發佈了25 篇原創文章 · 獲贊 9 · 訪問量 9萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章