From 0fa63ac0968cdc3e7ec14179e8d7c559b77132e9 Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Fri, 16 Oct 2020 20:18:38 +0300 Subject: [PATCH] Category: add NotNull constraint annotation to name attribute Signed-off-by: Pekka Helenius --- .../main/java/com/fjordtek/bookstore/model/book/Category.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/model/book/Category.java b/bookstore/src/main/java/com/fjordtek/bookstore/model/book/Category.java index 26cc68f..87a6409 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/model/book/Category.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/model/book/Category.java @@ -14,6 +14,7 @@ import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; +import javax.validation.constraints.NotNull; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -52,6 +53,7 @@ public class Category { unique = true, columnDefinition = "NVARCHAR(50)" ) + @NotNull private String name; // Omit from Jackson JSON serialization