Define default column value with annotations in Hibernate

后端 未结 2 816
予麋鹿
予麋鹿 2020-12-16 02:52

I know there are plenty of these questions here on SO and also on the net, but all the answers suggest using columnDefinition which is database specific and hen

2条回答
  •  生来不讨喜
    2020-12-16 03:20

    Following is working for me.

    @ColumnDefault("'0.0'")

    @Column(name = "avgRating")

    private float avgRating;

提交回复
热议问题