From a479b461e8cb5b6937b672490231761a70633efa Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Thu, 17 Sep 2020 19:04:20 +0300 Subject: [PATCH] Prefer 'Long' over 'long' data type for Ids Signed-off-by: Pekka Helenius --- .../src/main/java/com/fjordtek/bookstore/model/Book.java | 6 +++--- .../main/java/com/fjordtek/bookstore/model/Category.java | 6 +++--- .../java/com/fjordtek/bookstore/web/BookController.java | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/model/Book.java b/bookstore/src/main/java/com/fjordtek/bookstore/model/Book.java index d3b2537..8ab78c0 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/model/Book.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/model/Book.java @@ -73,7 +73,7 @@ public class Book { name = "bookIdGenerator", sequenceName = "bookIdSequence" ) - private long id; + private Long id; //////////////////// // Attributes with hard-coded constraints @@ -170,7 +170,7 @@ public class Book { // TODO consider accessibility restrictions? // NOTE: in default scenario, this is automatically generated - public void setId(long id) { + public void setId(Long id) { this.id = id; } @@ -203,7 +203,7 @@ public class Book { // TODO consider accessibility restrictions? - public long getId() { + public Long getId() { return id; } diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/model/Category.java b/bookstore/src/main/java/com/fjordtek/bookstore/model/Category.java index fe3aa53..64df084 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/model/Category.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/model/Category.java @@ -25,7 +25,7 @@ public class Category { name = "categoryIdGenerator", sequenceName = "categoryIdSequence" ) - private long id; + private Long id; //////////////////// // Attributes with hard-coded constraints @@ -41,7 +41,7 @@ public class Category { //////////////////// // Attribute setters - public void setId(long id) { + public void setId(Long id) { this.id = id; } @@ -56,7 +56,7 @@ public class Category { //////////////////// // Attribute getters - public long getId() { + public Long getId() { return id; } diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/web/BookController.java b/bookstore/src/main/java/com/fjordtek/bookstore/web/BookController.java index 67d0ddf..9222f27 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/web/BookController.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/web/BookController.java @@ -124,7 +124,7 @@ public class BookController { method = RequestMethod.GET ) public String webFormDeleteBook( - @PathVariable("id") long bookId, + @PathVariable("id") Long bookId, HttpServletRequest requestData ) { @@ -146,7 +146,7 @@ public class BookController { method = { RequestMethod.GET } ) public String webFormEditBook( - @PathVariable("id") long bookId, + @PathVariable("id") Long bookId, Model dataModel, HttpServletRequest requestData ) { @@ -177,7 +177,7 @@ public class BookController { public String webFormUpdateBook( @Valid @ModelAttribute("book") Book book, BindingResult bindingResult, - @PathVariable("id") long bookId, + @PathVariable("id") Long bookId, HttpServletRequest requestData ) {