title: Hibernate: On SQL Server 2008 column was altered from datetime to datetime2. How I can update hibernate config to reflect this?
body: <p>I have an application in which I created mappings of entities in Hibernate, so I could have access to some legacy tables on SQL Server 2005. Everything was working fine and as expected until the database was switched to a newer version of SQL Server - specifically, to SQL Server 2008. </p>
  
  <p>As the data were moved, all datetime columns in tables were changed to datetime2 and now, while starting the webapp on tomcat I receive an error:</p>
  
  <pre><code>Caused by: org.hibernate.HibernateException: Wrong column type (...)
  Found: datetime2, expected: datetime
  </code></pre>
  
  <p>What is the proper way of changing the config in hibernate to reflect this change? All entities are defined using annotations wherever possible, all database specific c</p>
  
  <p>I don't know if this is relevant but here are the versions of software which I am using:</p>
  
  <ul>
  <li>Hibernate 3.6.4.Final</li>
  <li>jTDS driver 1.2.5</li>
  </ul>
  
  <p>Thank you very much.</p>
  
  <h2>Edit: solution found</h2>
  
  <p>Thanks to ManuPK suggestions, I had switched from jTDS to Microsoft driver, sadly, after updating the settings of the webapp, I still received the same error. I solved it by creating custom class which is extending the <code>SQLServer2008Dialect</code> and registered <code>datetime2</code> as new column type. I don't know if this is the proper solution, but it works.</p>
  
  <pre><code>public class UpdatedSQLServerDialect extends SQLServer2008Dialect {
  
     public UpdatedSQLServerDialect () {
        super();
        registerColumnType(Types.DATE, "datetime2");
     }
  }
  </code></pre>