title: After upgrading Oracle JDBC driver, a Hibernate criteria query throws exception
body: <p>I recently upgraded the JDBC driver for Oracle 11g from <code>ojdbc14.jar</code> to <code>ojdbc6.jar</code>.
  However, the following criteria query does not work anymore now:</p>
  
  <pre><code>criteria = ...
  criteria = criteria.createAlias("contract", "contract")
      .add(Restrictions.disjunction()
      .add(Restrictions.isNull("contract.dateend"))
      .add(Restrictions.gt("contract.dateend", new Date())));
  </code></pre>
  
  <p>which restricts the result to entities which are associated to contracts which are still running.</p>
  
  <p>The following exception occurs:</p>
  
  <pre><code>...
  Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
      at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      at org.hibernate.loader.Loader.doList(Loader.java:2536)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
      at org.hibernate.loader.Loader.list(Loader.java:2271)
      at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1716)
      at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
      at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:369)
      at &lt;&lt;my method which creates the criteria query&gt;&gt;
      ... 61 more
  Caused by: java.sql.SQLException: year out of range.
      at oracle.jdbc.driver.DateCommonBinder.setOracleCYMD(OraclePreparedStatement.java:19241)
      at oracle.jdbc.driver.TimestampBinder.bind(OraclePreparedStatement.java:19520)
      at oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers(OraclePreparedStatement.java:3137)
      at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:2355)
      at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3579)
      at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3628)
      at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1493)
      at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
      at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
      at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
      at org.hibernate.loader.Loader.getResultSet(Loader.java:1953)
      at org.hibernate.loader.Loader.doQuery(Loader.java:802)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
      at org.hibernate.loader.Loader.doList(Loader.java:2533)
      ... 101 more
  </code></pre>
  
  <p>As said before, it still works fine with the old driver. The corresponding database column has type <code>DATE</code> which is supposed to be mapped 
  by Hibernate to <code>java.util.Date</code> by:</p>
  
  <pre><code>&lt;property name="dateend"&gt;
      &lt;column name="DATEEND" length="7" /&gt;
  &lt;/property&gt;
  </code></pre>
  
  <p>Do I have to change the Hibernate mapping for this column?</p>
  
  <p>Thanks in advance,
  Rainer.</p>