package com.baeldung.entity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.persistence.*; @Entity @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id", unique = true, nullable = false) private Long id; @Column private String name; @OneToOne(fetch = FetchType.LAZY, mappedBy = "user") private Address address; public User() { } public User(String name) { this.name = name; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Address getAddress() { return address; } public void setAddress(Address address) { this.address = address; } }