title: jsf hibernate crud form relationship
body: <p>i am using hibernate 4, jsf 2.2 and primefaces 4.
  When i am creating an entity CRUD form with relationships which strategy should i use?</p>
  
  <p>use object for relationship, and an entity generic converter :</p>
  
  <pre><code>&lt;h:inputHidden id="gender" value="#{user.gender}" converter="entityconverter"/&gt;
  </code></pre>
  
  <p>or use object.id </p>
  
  <pre><code>&lt;h:inputHidden id="gender_id" value="#{user.gender.id}" /&gt;
  </code></pre>
  
  <p><strong>Update :</strong>
  i am using standart entities created by Netbeans with Entity from database. </p>
  
  <p>User.java:</p>
  
  <pre><code>@JoinColumn(name = "gender", referencedColumnName = "id") 
  @ManyToOne(optional = false, fetch = FetchType.LAZY) 
  private Gender gender; 
  
  public Gender getGender() {
      return gender;
  }
  </code></pre>
  
  <p>Gender.java:</p>
  
  <pre><code>@Id 
  @GeneratedValue(strategy = GenerationType.IDENTITY) 
  @Basic(optional = false)    
  @Column(name = "id") 
  private Long id
  
  public Long getId() {
      return id;
  }
  </code></pre>