title: Hibernate how to get by id from lazy object
body: <p>I had entity A,A is many to one B,fetch type is lazy.</p>
  
  <p>When i use below code B still lazy.</p>
  
  <pre><code>A a  = session.get(A.class,aId);//a.getB(); is lazy
  B b = session.get(B.class,bId);//this object is same whith a.getB();
  
  //b.id is 0;
  //b.name is null;
  //b.age is 0;
  
  //if i remove A a  = session.get(A.class,aId);
  //then 
  
  //b.id is bId;
  //b.name is "Test";
  //b.age = 18;
  </code></pre>
  
  <p>how can i get don't empty B Use My code?</p>
  
  <pre><code>class A{
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="bId",nullable = false)
    B b;
    //getter and setter
  }
  
  class B{
    @Column
    int id;
    @Column
    String name;
    @Column
    int age;
  //getter and setter
  }
   //it is in my porject,Shipment is A,OrderDetail is B
  Shipment shipment = shipmentDao.getByDate(id, shipmentDate); 
  OrderDetail od = baseDao.getById(OrderDetail.class, id); 
  </code></pre>