diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java
index a591b83a8b..d59012a566 100644
--- a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java
+++ b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java
@@ -762,6 +762,11 @@ public abstract class Dialect implements ConversionContext {
*
year(arg) - synonym of extract(year from a)
*
*
+ * Note that according to this definition, the second() function returns
+ * a floating point value, contrary to the integer type returned by the
+ * native function with this name on many databases. Thus, we don't just
+ * naively map these HQL functions to the native SQL functions with the
+ * same names.
*/
public void initializeFunctionRegistry(QueryEngine queryEngine) {
final BasicTypeRegistry basicTypeRegistry = queryEngine.getTypeConfiguration().getBasicTypeRegistry();
diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java
index 146fcf2047..f163775bfe 100644
--- a/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java
+++ b/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java
@@ -527,6 +527,14 @@ public class MySQLDialect extends Dialect {
return getMySQLVersion().isBefore( 5, 7 ) ? super.currentTimestamp() : "current_timestamp(6)";
}
+ // for consistency, we could do this: but I decided not to
+ // because it seems to me that fractional seconds can't possibly
+ // be meaningful in a time, as opposed to a timestamp
+// @Override
+// public String currentTime() {
+// return getMySQLVersion().isBefore( 5, 7 ) ? super.currentTimestamp() : "current_time(6)";
+// }
+
/**
* {@code microsecond} is the smallest unit for
* {@code timestampadd()} and {@code timestampdiff()},
diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/function/CommonFunctionFactory.java b/hibernate-core/src/main/java/org/hibernate/dialect/function/CommonFunctionFactory.java
index ec916b2dbf..f64d8e7539 100644
--- a/hibernate-core/src/main/java/org/hibernate/dialect/function/CommonFunctionFactory.java
+++ b/hibernate-core/src/main/java/org/hibernate/dialect/function/CommonFunctionFactory.java
@@ -923,6 +923,11 @@ public class CommonFunctionFactory {
new CaseWhenEveryAnyEmulation( queryEngine.getTypeConfiguration(), false ) );
}
+ /**
+ * Note that we include these for completeness, but
+ * since their names collide with the HQL abbreviations
+ * for extract(), they can't actually be called from HQL.
+ */
public static void yearMonthDay(QueryEngine queryEngine) {
final BasicType integerType = queryEngine.getTypeConfiguration().getBasicTypeRegistry()
.resolve( StandardBasicTypes.INTEGER );
@@ -943,6 +948,11 @@ public class CommonFunctionFactory {
.register();
}
+ /**
+ * Note that we include these for completeness, but
+ * since their names collide with the HQL abbreviations
+ * for extract(), they can't actually be called from HQL.
+ */
public static void hourMinuteSecond(QueryEngine queryEngine) {
final BasicType integerType = queryEngine.getTypeConfiguration().getBasicTypeRegistry()
.resolve( StandardBasicTypes.INTEGER );