79075469

Date: 2024-10-10 17:05:11
Score: 2.5
Natty:
Report link

If anyone else is wondering an answer for this question, by using the @Column annotations, you can do the following as in the question above.

@Column(name = "IsActive", nullable = false, insertable = false)

private Short isActive;

the insertable property will not include this field in INSERT queries. Then the server will automatically put the default value assigned in the database itself.

Reasons:
  • No code block (0.5):
  • User mentioned (1): @Column
  • Low reputation (1):
Posted by: Ravidu Vithana