title: hibernate returning null for auto-generated timestamps from mysql
body: <p>i have a table in mysql which has a data type of timestamp as one of the columns, which gets a default value of CURRENT_TIME upon insertion.  and i have another timestamp column that has a default value of CURRENT_TIME upon update. i have these so that timestamp columns will get updated automatically on insertion and update (which works fine).</p>
  
  <p>now i am using cxf, hibernate/jpa, mysql, jackson to build a web service.
  i am simply creating a new record and retrieving it right away as below code shows.</p>
  
  <pre><code>Session session = getSession();  // sessionFactory.getCurrentSession();
  String accountId = (String)session.save(account);
  Account newAccount = (Account)session.load(Account.class, accountId);
  logger.info("created timestamp=" + newAccount.getCreatedTimestamp());
  </code></pre>
  
  <p>after above code is ran, i can see that new record is created in mysql with correct timestamps for createdTimestamp. however, logger.info() line above throws an exception because newAccount.getCreatedTimestamp() returns null. if i remove logger.info() line, i can see that newAccount object is populated with correct values except for createdTimestamp which is null.</p>
  
  <p>what's more odd is that after above code is ran (which is a part of HTTP POST operation), i call a HTTP GET service which just fetches a record that i just inserted by doing</p>
  
  <pre><code>session.get(Account.class, accountId);
  </code></pre>
  
  <p>and it correctly shows timestamps!</p>
  
  <p>i tried to sleep before session.load() or session.get() thinking that there might be a delay in inserting timestamp, but that didn't do much.  is there something special about hibernate session management that does not retrieve columns that mysql generates? what am i missing here? please help. </p>