title: Order by selected tables field from other table field, hibernate or simple sql
body: <p>I have 3 tables. My tables are</p>
  
  <pre><code>PRODUCT ( pro_id, name , api )
  Definition ( def_id, name )
  Product_details ( id, pro_id, def_id, value )
  </code></pre>
  
  <p>pro_id and def_id are foreign keys of tables product and definiton.</p>
  
  <p>My tables record are like this </p>
  
  <pre><code>Product ( 1, Goal , A01 ) , ( 2 Shampoo, A01 ) , ( 3, Cell, A02 )
  Definition ( 1, Effect ) , ( 2, Satisfaction ) , ( 3, total )
  Product_details ( 1, 1, 1, 5 ) , ( 2, 1 , 2, 1 ), ( 3, 1, 3, 3 ) ( 4, 2, 3, 2 )
  </code></pre>
  
  <p>I want to select product where API = "A01" and order by product_details value</p>
  
  <p>Solution should be Goal, Shampoo.</p>
  
  <p>I tried many things but , i couldnot get what i want,</p>
  
  <p>I am using jsf, hibernate, i cant write hibernate query coz i still could not do it with sql, can someone help me fro sql script or hibernate script.</p>