title: Hibernate: returning null when getting the object in a one to one relation
body: <p>Whenever I try to get the joined object it is returning null. Sample code below:</p>
  
  <h1>Table A</h1>
  
  <pre><code>id
  name
  b_id
  </code></pre>
  
  <h1>Table B</h1>
  
  <pre><code>id
  name
  </code></pre>
  
  <h1>Coding</h1>
  
  <pre><code>@Entity
  @Table(name = "A")
  public class A {
      private Integer id;
      @OneToOne
      @JoinColumn(name = "b_id", nullable = false)
      private B b;
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      public Integer getId() {
          return id;
      }
  
      public B getb() {        
          return b;
      }
  }
  
  @Entity
  @Table(name = "B")
  public class B {
      private Integer id;
      private String name;
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      public Integer getId() {
          return id;
      }
  
      public String getname() {        
          return name;
      }
  }
  </code></pre>
  
  <p>When I use <code>getA(id).getB()</code> function it returns null. When I use <code>getA</code> it returns a valid object and not null.</p>