Hi,
We are using Hibernate 3.3.1 GA. In our DB schema we have lots of tables with column type Oracle Date. In Java these columns are mapped to java.util.Date (We are only interested up to second precision)
We recently migrated to Oracle 11g, we noticed that some of our queries are not using the Indexes anymore. It turns out this is because these columns are mapped to java.sql.Timestamp which gets mapped to Oracle TIMESTAMP type rather than Date. This causes it to not to use the Indexes on columns type Date.
From what I can gather Hibernate maps java.util.Date to java.sql.Timestamp. Then its upto the JDBC driver to map this to the database type. Is there anything I can do in hibernate to change this mapping ?
Looking at Hibernate source code I noticed in the Dialect there are type mappings. So I tried changing it from
registerColumnType(Types.TIMESTAMP, "timestamp");
registerColumnType(Types.TIMESTAMP, "date");
which I believe is a change made for
http://opensource.atlassian.com/project ... se/HB-1049 in 3.0 but have no effect. I couldn't see it using this mapping when I do a query anyway. Is this only used for generating the DDL schema from mappings ?
If we downgrade the Oracle JDBC driver to 10g with the flag -Doracle.jdbc.V8Compatible=true it works fine. But on 11G driver the flag -Doracle.jdbc.V8Compatible is deprecated and doesn't seems to have any effect. But this is not ideal.
Any help greatly appreciated.
Regards,
Roshan