Spring中的Couchbase在保存时具有默认值

时间:2018-03-01 13:18:22

标签: spring-boot spring-data spring-data-jpa couchbase spring-data-couchbase

我们正在使用Couchbase数据库和Springboot,我们正面临一个问题:我们想要将模型的param设置为保存在数据库中时的默认值(只要它没有'已经设定好了。)

我们的模型类似于:

@Document
class Book {

...

@Field("quantity")
int quantity;

...

int getQuantity() {return quantity;}

void setQuantity(int quantity){this.quantity = quantity;}

...

}

那么,如何设置默认值而不使用默认构造函数在定义变量时设置默认值

非常感谢

0 个答案:

没有答案