add toString exclude
@@ -6,10 +6,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.*;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
+import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;
@Entity
@@ -18,6 +15,10 @@ import org.springframework.format.annotation.DateTimeFormat;
@AllArgsConstructor
@Builder
@Table(name = "user")
+@EqualsAndHashCode(
+ exclude = {"places", "comments", "rates", "verifyEmail", "addedPlaces", "favoritePlaces", "ownSecurity"})
+@ToString(
+ exclude = {"places", "comments", "rates", "verifyEmail", "addedPlaces", "favoritePlaces", "ownSecurity"})
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -46,10 +47,10 @@ public class User {
@Column(nullable = false)
private LocalDateTime dateOfRegistration;
- @OneToMany(mappedBy = "author")
+ @OneToMany(mappedBy = "author",fetch = FetchType.LAZY)
private List<Place> places = new ArrayList<>();
- @OneToMany(mappedBy = "user")
+ @OneToMany(mappedBy = "user",fetch = FetchType.LAZY)
private List<Comment> comments = new ArrayList<>();
@OneToMany(mappedBy = "user")
