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
604
604
BasicTypeRegistry basicTypeRegistry = functionContributions .getTypeConfiguration ().getBasicTypeRegistry ();
605
605
606
606
SqmFunctionRegistry functionRegistry = functionContributions .getFunctionRegistry ();
607
- functionRegistry .noArgsBuilder ( "localtime" )
608
- .setInvariantType (basicTypeRegistry .resolve ( StandardBasicTypes .TIMESTAMP ))
609
- .setUseParenthesesWhenNoArgs ( false )
610
- .register ();
607
+
611
608
// pi() produces a value with 7 digits unless we're explicit
612
609
if ( getMySQLVersion ().isSameOrAfter ( 8 ) ) {
613
610
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
654
654
655
655
SqmFunctionRegistry functionRegistry = functionContributions .getFunctionRegistry ();
656
656
657
- functionRegistry .noArgsBuilder ( "localtime" )
658
- .setInvariantType (basicTypeRegistry .resolve ( StandardBasicTypes .TIMESTAMP ))
659
- .setUseParenthesesWhenNoArgs ( false )
660
- .register ();
661
-
662
657
// pi() produces a value with 7 digits unless we're explicit
663
658
functionRegistry .patternDescriptorBuilder ( "pi" , "cast(pi() as double)" )
664
659
.setInvariantType ( basicTypeRegistry .resolve ( StandardBasicTypes .DOUBLE ) )
Original file line number Diff line number Diff line change 6
6
*/
7
7
package org .hibernate .orm .test .temporal ;
8
8
9
+ import java .sql .Time ;
9
10
import java .sql .Timestamp ;
10
11
11
12
import org .hibernate .dialect .MySQLDialect ;
18
19
import org .hibernate .testing .orm .junit .SessionFactory ;
19
20
import org .hibernate .testing .orm .junit .SessionFactoryScope ;
20
21
22
+ import org .hibernate .type .descriptor .java .JdbcTimeJavaType ;
21
23
import org .junit .jupiter .api .Test ;
22
24
23
25
import static org .junit .Assert .assertEquals ;
@@ -48,11 +50,13 @@ public void testTimeStampFunctions(SessionFactoryScope scope) {
48
50
);
49
51
Object [] oArray = (Object []) q .uniqueResult ();
50
52
for ( Object o : oArray ) {
51
- ( (Timestamp ) o ).setNanos ( 0 );
53
+ if ( o instanceof Timestamp ts ) {
54
+ ts .setNanos ( 0 );
55
+ }
52
56
}
53
57
final Timestamp now = (Timestamp ) oArray [0 ];
54
58
assertEquals ( now , oArray [1 ] );
55
- assertEquals ( now , oArray [2 ] );
59
+ assertTrue ( JdbcTimeJavaType . INSTANCE . areEqual ( new Time ( now . getTime () ), ( Time ) oArray [2 ] ) );
56
60
assertEquals ( now , oArray [3 ] );
57
61
assertTrue ( now .compareTo ( (Timestamp ) oArray [4 ] ) <= 0 );
58
62
}
You can’t perform that action at this time.
0 commit comments