File tree Expand file tree Collapse file tree 3 files changed +7
-11
lines changed
hibernate-community-dialects/src/main/java/org/hibernate/community/dialect
main/java/org/hibernate/dialect
test/java/org/hibernate/orm/test/temporal Expand file tree Collapse file tree 3 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -604,10 +604,7 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
604604 BasicTypeRegistry basicTypeRegistry = functionContributions .getTypeConfiguration ().getBasicTypeRegistry ();
605605
606606 SqmFunctionRegistry functionRegistry = functionContributions .getFunctionRegistry ();
607- functionRegistry .noArgsBuilder ( "localtime" )
608- .setInvariantType (basicTypeRegistry .resolve ( StandardBasicTypes .TIMESTAMP ))
609- .setUseParenthesesWhenNoArgs ( false )
610- .register ();
607+
611608 // pi() produces a value with 7 digits unless we're explicit
612609 if ( getMySQLVersion ().isSameOrAfter ( 8 ) ) {
613610 functionRegistry .patternDescriptorBuilder ( "pi" , "cast(pi() as double)" )
Original file line number Diff line number Diff line change @@ -654,11 +654,6 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
654654
655655 SqmFunctionRegistry functionRegistry = functionContributions .getFunctionRegistry ();
656656
657- functionRegistry .noArgsBuilder ( "localtime" )
658- .setInvariantType (basicTypeRegistry .resolve ( StandardBasicTypes .TIMESTAMP ))
659- .setUseParenthesesWhenNoArgs ( false )
660- .register ();
661-
662657 // pi() produces a value with 7 digits unless we're explicit
663658 functionRegistry .patternDescriptorBuilder ( "pi" , "cast(pi() as double)" )
664659 .setInvariantType ( basicTypeRegistry .resolve ( StandardBasicTypes .DOUBLE ) )
Original file line number Diff line number Diff line change 66 */
77package org .hibernate .orm .test .temporal ;
88
9+ import java .sql .Time ;
910import java .sql .Timestamp ;
1011
1112import org .hibernate .dialect .MySQLDialect ;
1819import org .hibernate .testing .orm .junit .SessionFactory ;
1920import org .hibernate .testing .orm .junit .SessionFactoryScope ;
2021
22+ import org .hibernate .type .descriptor .java .JdbcTimeJavaType ;
2123import org .junit .jupiter .api .Test ;
2224
2325import static org .junit .Assert .assertEquals ;
@@ -48,11 +50,13 @@ public void testTimeStampFunctions(SessionFactoryScope scope) {
4850 );
4951 Object [] oArray = (Object []) q .uniqueResult ();
5052 for ( Object o : oArray ) {
51- ( (Timestamp ) o ).setNanos ( 0 );
53+ if ( o instanceof Timestamp ) {
54+ ( (Timestamp ) o ).setNanos ( 0 );
55+ }
5256 }
5357 final Timestamp now = (Timestamp ) oArray [0 ];
5458 assertEquals ( now , oArray [1 ] );
55- assertEquals ( now , oArray [2 ] );
59+ assertTrue ( JdbcTimeJavaType . INSTANCE . areEqual ( new Time ( now . getTime () ), ( Time ) oArray [2 ] ) );
5660 assertEquals ( now , oArray [3 ] );
5761 assertTrue ( now .compareTo ( (Timestamp ) oArray [4 ] ) <= 0 );
5862 }
You can’t perform that action at this time.
0 commit comments