title: How to ensure date is stored from Java to SQLServer to millisecond resolution?
body: <p>We are using Hibernate.</p>
  
  <p>In Java, the object is java.util.Date.
  In SQLServer, the column is datetime2(7).</p>
  
  <p>When we store this object in SQLServer database and later retrieve it, this object is not having same value in millisecond resolution.</p>
  
  <p>For example, from Java: <code>Dec 01 2016 15:50.453</code> 
  When it comes back from the database: <code>Dec 01 2016 15:50.455</code></p>
  
  <p>So, we are encountering scenarios where the equals() is failing due to this design aspect of SQLServer.</p>
  
  <p>Is there something missing in Hibernate dialect, like for example: registering column types.</p>
  
  <p>Or should I define some conversion, so that I get the correct value, which I had saved.</p>