Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save gokman/25f1cc779d551f057bf326e99420477d to your computer and use it in GitHub Desktop.

Select an option

Save gokman/25f1cc779d551f057bf326e99420477d to your computer and use it in GitHub Desktop.
spring jpa - generated non-primary value become zero when update
//to accomplish this problem we need to add "updatable=false" to that column
//because without this definition when we need update a row automatically hibernate assign default value 0 (zero)
@Basic
@GeneratedValue
@Column(name = "id", insertable = false, updatable = false)
public long getId() {
return id;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment