0

I have Result entity and User entity and they are linked via @OneToOne annotation:

@OneToOne
@MapsId
private User user;

and

@OneToOne(mappedBy = "user", cascade = CascadeType.ALL)
private Result result;

but when I try to get all results via ajax:

resultRepo.findAll()

results are coming with users with all user fields including password and etc. How to get only specific fields from User entity when I request all results ?

Alan Hay
  • 21,957
  • 2
  • 53
  • 106
socm_
  • 781
  • 10
  • 25

1 Answers1

0

Use @JsonIgnore on your field and it will not show in json repsonse

Soheil Rahsaz
  • 679
  • 6
  • 20