Boa noite Devs do Guj.
Estou tentando entender um problema que está acontecendo aqui comigo.
Estou fazendo um cadastro normal de clientes e estava testando a função Patch, no H2.
Quando fui passar para o MySql, o que me ocorre, o get ele faz normalmente, porém o cadastro e alteração ele fornece a seguinte informação:
2022-04-22 20:06:52.685 ERROR 9180 — [nio-8080-exec-4] o.h.engine.jdbc.spi.SqlExceptionHelper : Field ‘id_cliente’ doesn’t have a default value
2022-04-22 20:06:52.692 ERROR 9180 — [nio-8080-exec-4] 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.orm.jpa.JpaSystemException: could not execute statement; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement] with root cause
Acho estranho, pois o campo id_cliente é pk do bd e também no modelo.
Segue arquivo do modelo e vou tentar colocar o print do bd.
Se alguém puder me ajudar a entender o que este problema, agradeço.
@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
public class Clientes {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id_Cliente;
//@Column(nullable = false)
private String nome;
//@Column(nullable = false, unique = true)
private String cpf;
//@Column(nullable = false)
private String endereco;
private int numero;
private String complemento;
//@Column(nullable = false)
private String bairro;
//@Column(nullable = false)
private String cidade;
//@Column(nullable = false)
private String uf;
private String telefone;
//@Column(nullable = false)
private String email;
//@Column(nullable = false)
private float rendimento;
private Date aniversario;
private Date cadastro;
}