title: jsf - foreign key in datatable
body: <p>I'm showing a list of Orders in a datatable , and one of its columns must show the customer_id of that order: customer_id is a fk in ManyToOne relationship. </p>
  
  <p><strong>Customer entity</strong></p>
  
  <pre><code>@Entity
  public class Customer {
  
      ///other columns
  
      @OneToMany(mappedBy = "cliente", fetch=FetchType.EAGER)
      private List&lt;Order&gt; orders;
  </code></pre>
  
  <p><strong>Order entity</strong></p>
  
  <pre><code>    @Entity
  @Table(name = "orders")
  
  public class Order implements Serializable{
  
      /**
       * 
       */
      private static final long serialVersionUID = 1L;
  
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private long id;
  
  
      @Column (nullable = false)
      private String state;
  
      @Column (nullable = false)
      @Temporal(TemporalType.TIMESTAMP)
      private Calendar openingDate;
  
      @Column (nullable = true)
      @Temporal(TemporalType.TIMESTAMP)
      private Calendar closingDate;
  
      @Column (nullable = true)
      @Temporal(TemporalType.TIMESTAMP)
      private Calendar evadingDate;
  
      @ManyToOne(cascade={ CascadeType.PERSIST, CascadeType.REMOVE },fetch=FetchType.LAZY)
      @JoinColumn(name = "customer_id") 
      private Customer customer;
  </code></pre>
  
  <p>and finally, this is the page where i'm putting the datatable with all the orders.</p>
  
  <p><strong>showOrders.xhtml</strong></p>
  
  <pre><code>&lt;h:dataTable id="list" value="#{orderController.orders}"
          var="order"&gt;
          &lt;h:column&gt;
              &lt;f:facet name="header"&gt;Nome&lt;/f:facet&gt;
              &lt;h:commandLink action="#{orderController.findOrder}"
                  value="#{order.id}" style="color: orange"&gt;
                  &lt;f:setPropertyActionListener target="#{orderController.id}"
                      value="#{order.id}" /&gt;
              &lt;/h:commandLink&gt;
          &lt;/h:column&gt;
          &lt;h:column&gt;
              &lt;f:facet name="header"&gt;Stato&lt;/f:facet&gt;
              &lt;h:outputText value="#{order.state}" /&gt;
          &lt;/h:column&gt;
          &lt;h:column&gt;
              &lt;f:facet name="header"&gt;Data Apertura&lt;/f:facet&gt;
              &lt;h:outputText value="#{order.openingDate.time}"&gt;
                  &lt;f:convertDateTime datestyle="full" type="date" /&gt;
              &lt;/h:outputText&gt;
          &lt;/h:column&gt;
          &lt;h:column&gt;
              &lt;f:facet name="header"&gt;Data Chiusura&lt;/f:facet&gt;
              &lt;h:outputText value="#{order.closingDate.time}"&gt;
                  &lt;f:convertDateTime datestyle="full" type="date" /&gt;
              &lt;/h:outputText&gt;
          &lt;/h:column&gt;
          &lt;h:column&gt;
              &lt;f:facet name="header"&gt;Data Evasione&lt;/f:facet&gt;
              &lt;h:outputText value="#{order.evadingDate.time}"&gt;
                  &lt;f:convertDateTime datestyle="full" type="date" /&gt;
              &lt;/h:outputText&gt;
          &lt;/h:column&gt;
          &lt;h:column&gt;
              &lt;f:facet name="header"&gt;ID Cliente&lt;/f:facet&gt;
              &lt;h:commandLink action="#{registerCustomer.detailsCustomer}"
                  value="#{order.customer.id}" style="color: orange"&gt;
                  &lt;f:setPropertyActionListener target="#{registerCustomer.id}"
                      value="#{order.customer.id}" /&gt; 
              &lt;/h:commandLink&gt;
          &lt;/h:column&gt;
  </code></pre>
  
  <p>Problem is, everything is fine except the customer_id, which doesn't show on the page. What am I do wrong?
  I've tried looot of things, changed type of fetching, changed the relationships...but i'm start to thinking it's a java problem , even if i can't really find the solution or some explanation about it on the internet. Could someone help me? I'm stuck :/</p>