0
I’ll explain my problem:
In my SQL system already came the error in INSERT, stating that the id field, which is autoincrement is stating that it is null:
INSERT INTO cliente_sub_grupo (id,id_cliente,subgrupo,tipo_atendimento,ind_valor_titular_igual_contrato,ind_valor_dependente_igual_contrato,valor_titular,valor_dependente) VALUES (:id,:id_cliente,:subgrupo,:tipo_atendimento,:ind_valor_titular_igual_contrato,:ind_valor_dependente_igual_contrato,:valor_titular,:valor_dependente)
INSERT INTO cliente_sub_grupo (id,id_cliente,subgrupo,tipo_atendimento,ind_valor_titular_igual_contrato,ind_valor_dependente_igual_contrato,valor_titular,valor_dependente) VALUES (:id,:id_cliente,:subgrupo,:tipo_atendimento,:ind_valor_titular_igual_contrato,:ind_valor_dependente_igual_contrato,:valor_titular,:valor_dependente)
org.postgresql.util.Psqlexception: ERROR: null value in column "id" violates not-null Constraint Detail: Failing Row contains (null, 12, vcxvxc, F, t, t, 1, 1, active).
After looking at the code I decided to look directly in the BD and in the following image I do a test registration, leaving the ID field as blank and gives the error of the second image:
This is the error when I insert directly from BD (the same error in my application console in INSERT):
The same console error:
client-sub-group.Insert org.postgresql.util.Psqlexception: ERROR: null value in column "id" violates not-null Constraint Detail: Failing Row contains (null, 12, vcxvxc, F, t, t, 1, 1, active).
org.postgresql.util.Psqlexception: ERROR: null value in column "id" violates not-null Constraint Detail: Failing Row contains (null, 12, vcxvxc, F, t, t, 1, 1, active).
What can be and how to fix this mistake.
The error was not in the INSERT. This Insert I posted was from the console of a gambiara of another company that passed this job from a library called Trust. Running the test directly in the database (INSERT) even leaving the id field blank, gave the same error. It was an error in the table, which was corrected as I mentioned above.
– Ramos