Thursday, June 20, 2013

Spring Hibernate: bookstore.domain.Book.java


package bookstore.domain;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;


@Entity (name = "book")
public class Book {

@Id
@GeneratedValue
private int bookId;

@NotNull
@Size (min = 2, max = 20)
private String title;

@DecimalMin (value = "2.0")
@DecimalMax (value = "100.0")
private double price;


public int getBookId() {
return bookId;
}
public void setBookId(int bookId) {
this.bookId = bookId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}


}

No comments:

Post a Comment