|
@ -81,6 +81,7 @@ public class Book { |
|
|
// Attributes with hard-coded constraints |
|
|
// Attributes with hard-coded constraints |
|
|
|
|
|
|
|
|
////////// |
|
|
////////// |
|
|
|
|
|
@Column(nullable = false) |
|
|
@Size( |
|
|
@Size( |
|
|
min = strMin, max = strMax, |
|
|
min = strMin, max = strMax, |
|
|
message = "Title length must be " + strMin + "-" + strMax + " characters" |
|
|
message = "Title length must be " + strMin + "-" + strMax + " characters" |
|
@ -95,6 +96,7 @@ public class Book { |
|
|
private String title; |
|
|
private String title; |
|
|
|
|
|
|
|
|
////////// |
|
|
////////// |
|
|
|
|
|
@Column(nullable = false) |
|
|
@Size( |
|
|
@Size( |
|
|
min = strMin, max = strMax, |
|
|
min = strMin, max = strMax, |
|
|
message = "Author length must be " + strMin + "-" + strMax + " characters" |
|
|
message = "Author length must be " + strMin + "-" + strMax + " characters" |
|
@ -113,7 +115,8 @@ public class Book { |
|
|
// @DateTimeFormat(pattern = "yyyy") |
|
|
// @DateTimeFormat(pattern = "yyyy") |
|
|
// private Timestamp year; |
|
|
// private Timestamp year; |
|
|
// ... |
|
|
// ... |
|
|
|
|
|
|
|
|
|
|
|
// TODO: Consider allowing 0 value if year is not known |
|
|
|
|
|
@Column(nullable = true) |
|
|
@Min( |
|
|
@Min( |
|
|
value = yearMin, |
|
|
value = yearMin, |
|
|
message = "Minimum allowed year: " + yearMin |
|
|
message = "Minimum allowed year: " + yearMin |
|
@ -122,7 +125,7 @@ public class Book { |
|
|
private int year; |
|
|
private int year; |
|
|
|
|
|
|
|
|
////////// |
|
|
////////// |
|
|
@Column(unique = true) |
|
|
|
|
|
|
|
|
@Column(unique = true, nullable = false) |
|
|
@NotBlank( |
|
|
@NotBlank( |
|
|
message = "Fill the ISBN code form" |
|
|
message = "Fill the ISBN code form" |
|
|
) |
|
|
) |
|
@ -141,6 +144,7 @@ public class Book { |
|
|
|
|
|
|
|
|
////////// |
|
|
////////// |
|
|
@NumberFormat(style = Style.NUMBER, pattern = "#,###.###") |
|
|
@NumberFormat(style = Style.NUMBER, pattern = "#,###.###") |
|
|
|
|
|
@Column(nullable = false) |
|
|
@Digits( |
|
|
@Digits( |
|
|
integer = 3, fraction = 2, |
|
|
integer = 3, fraction = 2, |
|
|
message = "Invalid price, possibly too many decimals" |
|
|
message = "Invalid price, possibly too many decimals" |
|
|