title: Hibernate bidirectional @ManyToOne, updating the not owning side not working
body: <p>I have a really simple setup to try out a bidirectional mapping with annotations:</p>
  
  <pre><code>@Entity
  public class TypeA extends AbstractModel&lt;TypeA&gt; {
  
      @Id
      @GeneratedValue
      private int id;
  
      @OneToMany(mappedBy="a")
      private Collection&lt;TypeB&gt; bs;
  
      // Getters &amp; Setters ... 
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>@Entity
  public class TypeB extends AbstractModel&lt;TypeB&gt; {
  
      private static final long serialVersionUID = -3526384868922938604L;
  
      @Id
      @GeneratedValue
      private int id;
  
      @ManyToOne()
      @JoinColumn(name="a_id")
      private TypeA a;
  }
  </code></pre>
  
  <p>When I set the property TypeA.bs this does not affect the mapping, although it should. See the following example:</p>
  
  <pre><code>TypeB b = new TypeB();
  this.typeBDao.save(b);
  
  TypeA a = new TypeA();
  a.setBs(ListUtils.createList(b));
  
  System.out.println(a.getBs()); // output: [TypeB@25fe4d40]
  
  this.typeADao.save(a);
  
  System.out.println(a.getBs()); // output: [TypeB@25fe4d40]
  
  this.typeADao.refresh(a);
  
  System.out.println(a.getBs()); // output: []
  
  this.typeBDao.refresh(b);
  System.out.println(b.getA()); // output: null
  </code></pre>
  
  <p>If the mapping is bidirectional, the collection should be populated and the property a of b should be updated, but it isnt. Any ideas?</p>
  
  <p><strong>Edit</strong> Thanks for your help folks, now I got it!</p>