title: Date change when save from Java (Hibernate) to Oracle 11g R2
body: <p>I have a scheduler that run after midnight (around 1 am), to move data from Redis to Oracle. To get the actual date from yesterday I used JodaTime and substract the date by 1 day, the code looks like this </p>
  
  <pre><code>    DateTime today = new DateTime();
      logger.info("today date = {}", today);
  
      DateTime dateTimeMinus1 = today.minusDays(1);
      logger.info("today dateTimeMinus1 = {}", dateTimeMinus1);
  </code></pre>
  
  <p>And the logger output like this :</p>
  
  <pre><code>today date = 2015-02-13T01:13:00.073+07:00
  today dateTimeMinus1 = 2015-02-12T01:13:00.073+07:00
  </code></pre>
  
  <p>after that I convert the JodaTime object to java.util.Date and set a property on a Java object (don't ask why, this is the requirement) using code like this :</p>
  
  <pre><code>myObject.setTxDate(dateTimeMinus1.toDate());
  </code></pre>
  
  <p>and then I save <code>myObject</code> to Oracle 11g R2 database using Hibernate, the mapping look like this </p>
  
  <pre><code>&lt;property name="txDate" column="TX_DATE" type="timestamp" not-null="false"  /&gt;
  </code></pre>
  
  <p>As you can see from log output above the <code>dateTimeMinus1</code> is print the correct date (12 Feb 2015 1:13 AM) but when I query the date in Oracle in change to <code>11-02-2015 18:13:00</code></p>
  
  <p>I check the timezone between the apps server and db server, both of them set to same timezone (+07:00)</p>
  
  <p>Any ideas what that could have been change the date when it's saved to database ?</p>