title: How to use hibernate lazy loading with column that can be null
body: <p>This is my entity:</p>
  
  <pre><code>@Entity
  @Table(name = "users")
  public class User {
  
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long id;
  
  @Column(name = "name")
  private String name;
  
  @Column(name = "surname")
  private String surname;
  
  
  @ManyToOne(fetch = FetchType.LAZY, cascade=CascadeType.MERGE)
  @JoinColumn(name = "id_city")
  private City city;
  //...
  
  }
  </code></pre>
  
  <p>In my Repository I have:</p>
  
  <pre><code>public interface UserRepository extends JpaRepository&lt;User, Long&gt;{
  
  @Query("SELECT u FROM User u JOIN FETCH u.city")
  public List&lt;User&gt; findAllUserForApi();
  
  }
  </code></pre>
  
  <p>If there are any cities in table, <code>findAllUserForApi()</code> shows me full information about user:</p>
  
  <pre><code>[{"id":1,"name":"John","surname":"Pillman","city":{"id":1,"name":"New York"}]
  </code></pre>
  
  <p>If there are no cities, I want to get at least <code>[{"id":1,"name":"John","surname":"Pillman","city":null]</code>
  But I've got nothing: []</p>
  
  <p>Help me please. </p>