title: HQL : Getting the primary key of an object
body: <p>I am using HQL to save an object in the DB. It is something like this </p>
  
  <pre><code>Query query = sessionFactory.getCurrentSession().createQuery(ASK_FOR_HELP_SAVE_QUERY);
          query.setInteger("status", askForHelp.getStatus());
          query.setString("requestId", askForHelp.getRequestId());
          query.setString("toAccountId", askForHelp.getToAccountId());
          query.setDate("creationDate", askForHelp.getCreationDate());
          query.executeUpdate()
  </code></pre>
  
  <p>;</p>
  
  <p>Now i want the primary key(sequence in DB) of the created object in the DB. I cannot use the select query because no combination of fields will make this object unique in the DB , except the primary key.</p>
  
  <p>I there a way to do this.</p>
  
  <p>Thanks!
  Pratik</p>