Niranjanan H
Niranjanan H

Reputation: 43

Is there an option in hibernate like to populate values for already created records while creating a column?

I am trying to create a column in the database and set default value as a 1 bit(0/1).But when hibernate is run the column is created and null is populated for already created records. Is there any specific annotation or a method in hibernate to populate values?

Upvotes: 1

Views: 31

Answers (1)

Ramachandra Reddy
Ramachandra Reddy

Reputation: 301

Can you try with below code

@Column(name="columnName", columnDefinition="default '<defaultValue>'")
private String columnName;}

Upvotes: 1

Related Questions