其他分享
首页 > 其他分享> > org.hibernate.HibernateException: The database returned no natively generated identity value

org.hibernate.HibernateException: The database returned no natively generated identity value

作者:互联网

org.hibernate.HibernateException: The database returned no natively generated identity value

problem

使用hibernate新增数据报错

org.hibernate.HibernateException: The database returned no natively generated identity value

reason

table的字段id不是自增特性

solution

设置id为自增特性

-- 将id字段设置为主键,不为空,自增即可
alter table User modify id int(11) not Null auto_increment primary key;

标签:自增,hibernate,natively,returned,no,id
来源: https://blog.csdn.net/qubes/article/details/122152057