org.hibernate.exception.GenericJDBCException

来源:互联网 发布:fast迅捷网络 编辑:程序博客网 时间:2024/06/05 02:17

    刚刚开始接触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设置为自增,做添加操作时,也没有给其赋值,所以才插入异常。

 

原创粉丝点击