@GeneratedValue(strategy = GenerationType.AUTO) not working as thought

前端 未结 7 980
予麋鹿
予麋鹿 2020-12-14 18:09

I\'m trying to persist an object to a database. Keep getting \'Column ID cannot accept null value error\'. My object looks like this:

    @Entity
public cl         


        
7条回答
  •  庸人自扰
    2020-12-14 18:17

    In my case it was about bad dialect:

    hibernate.dialect=org.hibernate.dialect.H2Dialect
    

    instead of:

    hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect
    

    when I switched to the production database. Hibernate tried to use strategy prepared for different db engine.

提交回复
热议问题