發表文章

目前顯示的是 1月, 2014的文章

Java’s Hibernate – Timestamp 造成 performance slow 的問題

Oracle 在使用 Hibernate 時, 其 Condition 中有 Timestamp 時會造成 performance slow 的問題, 從官網上看到這篇在此記錄一下.   Simple Data Types What is going on with DATE and TIMESTAMP ? This section is on simple data types. :-) Prior to 9.2, the Oracle JDBC drivers mapped the DATE SQL type to java.sql.Timestamp . This made a certain amount of sense because the Oracle DATE SQL type contains both date and time information as does java.sql.Timestamp . The more obvious mapping to java.sql.Date was somewhat problematic as java.sql.Date does not include time information. It was also the case that the RDBMS did not support the TIMESTAMP SQL type, so there was no problem with mapping DATE to Timestamp . In 9.2 TIMESTAMP support was added to the RDBMS. The difference between DATE and TIMESTAMP is that TIMESTAMP includes nanoseconds and DATE does not. So, beginning in 9.2, DATE is mapped to Date and TIMESTAMP is mapped to Timestamp . Unfortunately if you were relying on DATE values to contain time inform