I'm making a Spring boot application with Hibernate ORM framework.
I have an @Entity class in my code:
@Entity
@Table(name = "thing")
public class Thing {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "thing_id")
private long id;
@Column(name = "name")
private String name;
@Column(name = "price")
private int price;
I successfully can persist a Thing to my datasource. And thing_id is generated as expected.
But I cannot insert a record directly in database manager (e.g. DataGrip):
insert into thing (name, price)
values ('aaa', 123);
I have a warning and appropriate error when trying to insert:
Following columns have no computed/default value and must be listed explicitly: thing_id
So how can I make a column value autogenerated during insertion directly in database manager?