title: JSF Primefaces SelectOneMenu
body: <p>Person can have only one car , but in the datatable I want to display all the cars in the list but select the one user person belongs to. This way user can update any person's car on the fly.</p>
  
  <p>Let say I have two <code>tables</code></p>
  
  <p><code>Person</code></p>
  
  <pre><code>id 
  name 
  car_id
  </code></pre>
  
  <p><code>Cars</code></p>
  
  <pre><code>id
  name
  </code></pre>
  
  <p>Ideally , <code>person</code> should have <code>Cars</code> id as <code>primary</code> key but that is not the case. So each person has car ,right.</p>
  
  <p>Now I am displaying list of <code>person</code> in datatable e.g.</p>
  
  <pre><code>------------------------------------
  Name | Car 
  ----------------------------------------
  ABC | 1
  DDD | 2
  </code></pre>
  
  <p>But I want to show like :</p>
  
  <pre><code>------------------------------------
  Name | Car 
  ----------------------------------------
  ABC | Toyota
  DDD | Ford
  </code></pre>
  
  <p>The existing code :</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;p:dataTable value="#{test.persons} var="person"&gt;
      &lt;p:column headerText="Name"&gt; 
          #{person.name}
      &lt;/p:column&gt;
      &lt;p:column headerText="Name"&gt; 
          #{person.carID}
      &lt;/p:column&gt;
  &lt;/p:dataTable&gt;
  </code></pre>
  
  <p>But I want to do something like:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;p:dataTable value="#{test.persons} var="person"&gt;
      &lt;p:column headerText="Name"&gt; 
          #{person.name}
      &lt;/p:column&gt;
      &lt;p:column headerText="Car"&gt;
          &lt;p:selectOneMenu value="#{test.selectedCar}"
              converter="entityConverter"&gt;
              &lt;f:selectItems value="#{spMBean.cars}" var="car" 
                  itemLabel="#{car.name}" itemValue="#{car}" /&gt;
          &lt;/p:selectOneMenu&gt;
      &lt;/p:column&gt;
  &lt;/p:dataTable&gt;
  </code></pre>
  
  <p>If someone can help me with this, I'll highly appreciate that. </p>