JdbcDateTypeDescriptor

I struggling to understand org.hibernate.type.descriptor.java.JdbcDateTypeDescriptor. There are two issues I don’t understand.

  1. Why is the type parameter is java.util.Date and not java.sql.Date? I get the impression that org.hibernate.type.descriptor.java.DateTypeDescriptor is intended for java.util.Date and org.hibernate.type.descriptor.java.JdbcDateTypeDescriptor is intended for java.sql.Date
  2. org.hibernate.type.descriptor.java.JdbcDateTypeDescriptor.wrap(X, WrapperOptions) returns a java.util.Date if a java.util.Date is passed in, otherwise a java.sql.Date is returned. That means when a java.sql.Timestamp is passed in the very same instance is returned.

That’s a good question. Maybe we need to review the code and see if we need to make the JdbcDateTypeDescriptor comply to handling java.sql.Date and not mix it with java.util.Date.

Plewase open a Jira issue for this.

There you go HHH-12586

Thanks for filling the issue.