|
@ -2,6 +2,8 @@ |
|
|
|
|
|
|
|
|
package com.fjordtek.bookstore.model; |
|
|
package com.fjordtek.bookstore.model; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
|
import javax.persistence.Column; |
|
|
import javax.persistence.Column; |
|
|
|
|
|
|
|
|
//import java.sql.Timestamp; |
|
|
//import java.sql.Timestamp; |
|
@ -149,8 +151,7 @@ public class Book { |
|
|
@DecimalMax( |
|
|
@DecimalMax( |
|
|
value = maxPrice, message = "Too high price value. Maximum allowed: " + maxPrice |
|
|
value = maxPrice, message = "Too high price value. Maximum allowed: " + maxPrice |
|
|
) |
|
|
) |
|
|
// TODO: Use BigDecimal to keep exact precision? |
|
|
|
|
|
private double price; |
|
|
|
|
|
|
|
|
private BigDecimal price; |
|
|
|
|
|
|
|
|
@ManyToOne( |
|
|
@ManyToOne( |
|
|
//fetch = FetchType.LAZY, |
|
|
//fetch = FetchType.LAZY, |
|
@ -188,7 +189,7 @@ public class Book { |
|
|
this.isbn = isbn; |
|
|
this.isbn = isbn; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void setPrice(double price) { |
|
|
|
|
|
|
|
|
public void setPrice(BigDecimal price) { |
|
|
this.price = price; |
|
|
this.price = price; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -221,7 +222,7 @@ public class Book { |
|
|
return isbn; |
|
|
return isbn; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public double getPrice() { |
|
|
|
|
|
|
|
|
public BigDecimal getPrice() { |
|
|
return price; |
|
|
return price; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -234,7 +235,7 @@ public class Book { |
|
|
|
|
|
|
|
|
public Book() {} |
|
|
public Book() {} |
|
|
|
|
|
|
|
|
public Book(String title, String author, int year, String isbn, double price, Category category) { |
|
|
|
|
|
|
|
|
public Book(String title, String author, int year, String isbn, BigDecimal price, Category category) { |
|
|
// super(); |
|
|
// super(); |
|
|
this.title = title; |
|
|
this.title = title; |
|
|
this.author = author; |
|
|
this.author = author; |
|
|