Alguém pode me ajudar com esse erro ao tentar persitir na tabela TOPICO?
O @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
não está gerando o ID para poder inserir o novo registro em TOPICO
ERRO:
2021-12-13 23:16:18.663 WARN 6547 --- [nio-8080-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 23502, SQLState: 23502
2021-12-13 23:16:18.664 ERROR 6547 --- [nio-8080-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper : NULL not allowed for column "ID"; SQL statement:
insert into topico (id, autor_id, curso_id, data_criacao, mensagem, status, titulo) values (null, ?, ?, ?, ?, ?, ?) [23502-202]
2021-12-13 23:16:18.670 ERROR 6547 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement] with root cause
org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: NULL not allowed for column "ID"; SQL statement:
insert into topico (id, autor_id, curso_id, data_criacao, mensagem, status, titulo) values (null, ?, ?, ?, ?, ?, ?) [23502-202]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:508) ~[h2-2.0.202.jar:2.0.202]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:477) ~[h2-2.0.202.jar:2.0.202]
at org.h2.message.DbException.get(DbException.java:223) ~[h2-2.0.202.jar:2.0.202]
at org.h2.message.DbException.get(DbException.java:199) ~[h2-2.0.202.jar:2.0.202]
at org.h2.table.Column.validateConvertUpdateSequence(Column.java:365) ~[h2-2.0.202.jar:2.0.202]
at org.h2.table.Table.convertInsertRow(Table.java:931) ~[h2-2.0.202.jar:2.0.202]
at org.h2.command.dml.Insert.insertRows(Insert.java:167) ~[h2-2.0.202.jar:2.0.202]
at org.h2.command.dml.Insert.update(Insert.java:135) ~[h2-2.0.202.jar:2.0.202]
at org.h2.command.CommandContainer.executeUpdateWithGeneratedKeys(CommandContainer.java:246) ~[h2-2.0.202.jar:2.0.202]
at org.h2.command.CommandContainer.update(CommandContainer.java:167) ~[h2-2.0.202.jar:2.0.202]
at org.h2.command.Command.executeUpdate(Command.java:247) ~[h2-2.0.202.jar:2.0.202]
at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:209) ~[h2-2.0.202.jar:2.0.202]
at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:169) ~[h2-2.0.202.jar:2.0.202]
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61) ~[HikariCP-4.0.3.jar:na]
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java) ~[HikariCP-4.0.3.jar:na]