title: Just getting id column value not using join in hibernate object one to many relation
body: <p>I'm using hibernate 4+.</p>
  <p>I have two sample tables.</p>
  <p>Table A</p>
  <pre><code>public class A {
    @Id
    private int id;
  
    @OneToMany(fetch=LAZY)
    private List&lt;B&gt; list;
  
    // skip getter&amp;setter
  }
  </code></pre>
  <p>Table B</p>
  <pre><code>public class B {
    @Id
    private int id;
  
    @ManyToOne(fetch=LAZY)
    @JoinColumn(name=&quot;b_id&quot;)
    private A a;
  
    // skip getter&amp;setter
  }
  </code></pre>
  <p>Table A(1) - (n)Table B Relation</p>
  <p>Can I just get A's id in object B not using join? Something like:</p>
  <pre><code>int aid = b.getA().getId(); // b is instance of B;
  </code></pre>
  <p>Although I can use int value instead of A when I declare class B.
  But another service layer use A with join.</p>
  <p>Can I just get id(fk) value?</p>