title: JavaDB/Hibernate/Swing autosort
body: <p>I have a Java swing application with Hibernate and network JavaDB/DerbyDB. There is a table which is like this in structure:</p>
  
  <p>TestID QuestionID<br>
  T1234     Q1<br>
  T1234     Q2<br>
  T1234     Q3<br>
  T1234     Q4<br>
  ..<br>
  ..<br>
  T1234     Q10<br></p>
  
  <p>where combination of TestID and QuestionID has been defined as the primary key. Whenever i add/insert a row with Test ID 'T1234' and QuestionID 'Q10', the record gets added immediately after the record containing QuestionID 'Q1'. Example:</p>
  
  <p>TestID QuestionID<br>
  <strong>T1234     Q1<br>
  T1234     Q10<br></strong>
  T1234     Q3<br>
  T1234     Q4<br></p>
  
  <p>I don't want this to happen as this is causing me trouble while fetching the records. Could you please let me know what should i do to avoid this.</p>
  
  <p>Help will be appreciated.</p>