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 @@ -618,10 +618,7 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
618618 BasicTypeRegistry basicTypeRegistry = functionContributions .getTypeConfiguration ().getBasicTypeRegistry ();
619619
620620 SqmFunctionRegistry functionRegistry = functionContributions .getFunctionRegistry ();
621- functionRegistry .noArgsBuilder ( "localtime" )
622- .setInvariantType (basicTypeRegistry .resolve ( StandardBasicTypes .TIMESTAMP ))
623- .setUseParenthesesWhenNoArgs ( false )
624- .register ();
621+
625622 // pi() produces a value with 7 digits unless we're explicit
626623 if ( getMySQLVersion ().isSameOrAfter ( 8 ) ) {
627624 functionRegistry .patternDescriptorBuilder ( "pi" , "cast(pi() as double)" )
Original file line number Diff line number Diff line change @@ -634,11 +634,6 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
634634
635635 SqmFunctionRegistry functionRegistry = functionContributions .getFunctionRegistry ();
636636
637- functionRegistry .noArgsBuilder ( "localtime" )
638- .setInvariantType (basicTypeRegistry .resolve ( StandardBasicTypes .TIMESTAMP ))
639- .setUseParenthesesWhenNoArgs ( false )
640- .register ();
641-
642637 // pi() produces a value with 7 digits unless we're explicit
643638 functionRegistry .patternDescriptorBuilder ( "pi" , "cast(pi() as double)" )
644639 .setInvariantType ( basicTypeRegistry .resolve ( StandardBasicTypes .DOUBLE ) )
Original file line number Diff line number Diff line change 44 */
55package org .hibernate .orm .test .temporal ;
66
7+ import java .sql .Time ;
78import java .sql .Timestamp ;
89
910import org .hibernate .dialect .MySQLDialect ;
1617import org .hibernate .testing .orm .junit .SessionFactory ;
1718import org .hibernate .testing .orm .junit .SessionFactoryScope ;
1819
20+ import org .hibernate .type .descriptor .java .JdbcTimeJavaType ;
1921import org .junit .jupiter .api .Test ;
2022
2123import static org .junit .Assert .assertEquals ;
@@ -46,11 +48,13 @@ public void testTimeStampFunctions(SessionFactoryScope scope) {
4648 );
4749 Object [] oArray = (Object []) q .uniqueResult ();
4850 for ( Object o : oArray ) {
49- ( (Timestamp ) o ).setNanos ( 0 );
51+ if ( o instanceof Timestamp ts ) {
52+ ts .setNanos ( 0 );
53+ }
5054 }
5155 final Timestamp now = (Timestamp ) oArray [0 ];
5256 assertEquals ( now , oArray [1 ] );
53- assertEquals ( now , oArray [2 ] );
57+ assertTrue ( JdbcTimeJavaType . INSTANCE . areEqual ( new Time ( now . getTime () ), ( Time ) oArray [2 ] ) );
5458 assertEquals ( now , oArray [3 ] );
5559 assertTrue ( now .compareTo ( (Timestamp ) oArray [4 ] ) <= 0 );
5660 }
You can’t perform that action at this time.
0 commit comments