java.sql.Date does not implement toInstant, which is used by the java.util.Date bridge. So we get this:
java.lang.UnsupportedOperationException
at java.sql.Date.toInstant(Date.java:304)
at org.hibernate.search.mapper.pojo.bridge.builtin.impl.DefaultJavaUtilDateValueBridge.toIndexedValue(DefaultJavaUtilDateValueBridge.java:26)
This is a huge problem, because ORM will definitely put a java.sql.Date value in a java.util.Date property annotated with @Temporal(TemporalType.DATE) when loading from the database, and the entity reindexing will fail when reindexing. We should probably implement DefaultJavaUtilDateValueBridge exactly as DefaultJavaSqlDateValueBridge to avoid any problem. And also we should add a test case (maybe add a few java.sql.Date instances in JavaUtilDatePropertyTypeDescriptor). We probably have a similar problem for java.sql.Time, and maybe also for java.sql.Timestamp (maybe not for the last one, but it doesn't hurt to test). |