title: Jackson bidirectional relationship (One-to-many) not working
body: <p>I'm using Spring(xml+annotations), Hibernate(annotations) in this web service project. The database relationship diagram, models, expected and actual output are given below,</p>
  
  <p><a href="https://i.stack.imgur.com/hJUxl.png" rel="nofollow noreferrer">Database Table relationship</a></p>
  
  <p>Customer.java</p>
  
  <pre><code>@Entity
  @Table(name="customer")
  public class Customer implements Serializable{
      private static final long serialVersionUID = 1L;
      @Id
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      @Column(name="customer_id", unique=true, nullable =false)
      long customerId;
      @Column(name="name")
      String name;
      @Column(name="secondary_name")
      String secondaryName;
      @Column(name="date")
      Date date;
      @Column(name="address")
      String address;
      @Column(name="post")
      String post;
      @Column(name="pin")
      String pin;
      @Column(name="phone")
      String phone;
      @OneToMany(fetch=FetchType.LAZY, mappedBy="customer", cascade=CascadeType.ALL)
      @JsonManagedReference
      Set&lt;Loan&gt; loans = new HashSet&lt;Loan&gt;();
      //constructors, getters and setters
  }
  </code></pre>
  
  <p>Loan.java</p>
  
  <pre><code>public class Loan implements Serializable{
      /**
       * 
       */
      private static final long serialVersionUID = 1L;
      @Id
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      @Column(name="loan_id", nullable=false, unique=true)
      long loanId;
      @ManyToOne(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
      @JoinColumn(name="customer_id", nullable = false)
      @JsonBackReference
      Customer customer;
      @Column(name="date", nullable=false)
      Date date;
      @Column(name="amount", nullable=false)
      double amount;
      @OneToMany(fetch=FetchType.LAZY, mappedBy="loan", cascade=CascadeType.ALL)
      @JsonManagedReference
      List&lt;Item&gt; items = new ArrayList&lt;Item&gt;();
      //constructors, getters, setters
  }
  </code></pre>
  
  <p>Item.java</p>
  
  <pre><code>public class Item implements Serializable{
      /**
       * 
       */
      private static final long serialVersionUID = 1L;
      @Id
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      @Column(name="item_id", nullable=false, unique=true)
      long itemId;
      @ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.ALL)
      @JoinColumn(name="loan_id", nullable = false)
      @JsonBackReference
      Loan loan;
      @Column(name="name", nullable=false)
      String name;
      @Column(name="weight", nullable=false)
      double weight;
      //constructors, setters, getters
  }
  </code></pre>
  
  <p>Actual output:Here, customer details are not shown</p>
  
  <pre><code>{  
     "loanId":4,
     "date":1484937000000,
     "amount":10000.0,
     "items":[  
        {  
           "itemId":3,
           "name":"Item1",
           "weight":10.0
        },
        {  
           "itemId":4,
           "name":"Item2",
           "weight":20.0
        }
     ]
  }
  </code></pre>
  
  <p>Expected output: need to display customer details also when looking for a loan</p>
  
  <pre><code>{  
     "loanId":4,
     "customer":{  
        "customerId":2,
        "name":"Prem",
        "address":"Street,State"
     },
     "date":1484937000000,
     "amount":10000.0,
     "items":[  
        {  
           "itemId":3,
           "name":"Item1",
           "weight":10.0
        },
        {  
           "itemId":4,
           "name":"Item2",
           "weight":20.0
        }
     ]
  }
  </code></pre>
  
  <p>I can able to fetch the customer details from the database and fail to load it using Jackson Json. 
  If I remove @JsonManagedReference, I end up with circular loop.
  If I remove @JsonBackReference, no effects in the output.
  Complete code at: <a href="https://github.com/liwevire/TM_Service" rel="nofollow noreferrer">https://github.com/liwevire/TM_Service</a>
  Thanks in advance.</p>