content: package com.adamzareba.spring.security.oauth2.model;
  
  import com.fasterxml.jackson.annotation.JsonBackReference;
  
  import java.io.Serializable;
  
  import javax.persistence.CascadeType;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.FetchType;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.JoinColumn;
  import javax.persistence.ManyToOne;
  import javax.persistence.OneToOne;
  import javax.persistence.Table;
  
  import lombok.Getter;
  import lombok.Setter;
  
  @Entity
  @Table(name = "OFFICE")
  @Getter
  @Setter
  public class Office implements Serializable {
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      @Column(name = "ID", updatable = false, nullable = false)
      private Long id = null;
  
      @Column(name = "NAME", nullable = false)
      private String name;
  
      @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
      @JoinColumn(name = "ADDRESS_ID")
      private Address address;
  
      @ManyToOne(fetch = FetchType.LAZY)
      @JsonBackReference
      private Department department;
  }
  