I struggling to understand org.hibernate.type.descriptor.java.JdbcDateTypeDescriptor. There are two issues I don’t understand.
- 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
- 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.