Browse Source

Hide Id fields from JSON data. Necessary?

Signed-off-by: Pekka Helenius <fincer89@hotmail.com>
v0.0.2-alpha
Pekka Helenius 4 years ago
parent
commit
c6707e5436
2 changed files with 4 additions and 0 deletions
  1. +2
    -0
      bookstore/src/main/java/com/fjordtek/bookstore/model/Book.java
  2. +2
    -0
      bookstore/src/main/java/com/fjordtek/bookstore/model/Category.java

+ 2
- 0
bookstore/src/main/java/com/fjordtek/bookstore/model/Book.java View File

@ -24,6 +24,7 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonManagedReference; import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.fjordtek.bookstore.annotation.CurrentYear; import com.fjordtek.bookstore.annotation.CurrentYear;
@ -73,6 +74,7 @@ public class Book {
name = "bookIdGenerator", name = "bookIdGenerator",
sequenceName = "bookIdSequence" sequenceName = "bookIdSequence"
) )
@JsonIgnore
private Long id; private Long id;
//////////////////// ////////////////////


+ 2
- 0
bookstore/src/main/java/com/fjordtek/bookstore/model/Category.java View File

@ -12,6 +12,7 @@ import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator; import javax.persistence.SequenceGenerator;
import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity @Entity
public class Category { public class Category {
@ -27,6 +28,7 @@ public class Category {
name = "categoryIdGenerator", name = "categoryIdGenerator",
sequenceName = "categoryIdSequence" sequenceName = "categoryIdSequence"
) )
@JsonIgnore
private Long id; private Long id;
//////////////////// ////////////////////


Loading…
Cancel
Save