49
49
import static org .hibernate .type .SqlTypes .TIMESTAMP_WITH_TIMEZONE ;
50
50
import static org .hibernate .type .SqlTypes .TIME_WITH_TIMEZONE ;
51
51
import static org .hibernate .type .SqlTypes .TINYINT ;
52
+ import static org .hibernate .type .SqlTypes .UUID ;
52
53
import static org .hibernate .type .SqlTypes .VARBINARY ;
53
54
import static org .hibernate .type .SqlTypes .VARCHAR ;
54
55
import org .hibernate .type .StandardBasicTypes ;
56
+ import org .hibernate .type .descriptor .java .UUIDJavaType ;
55
57
import org .hibernate .type .descriptor .jdbc .JdbcType ;
58
+ import org .hibernate .type .descriptor .jdbc .UUIDJdbcType ;
56
59
import org .hibernate .type .descriptor .jdbc .spi .JdbcTypeRegistry ;
57
60
import org .hibernate .type .descriptor .sql .internal .DdlTypeImpl ;
58
61
import org .hibernate .type .descriptor .sql .spi .DdlTypeRegistry ;
@@ -111,6 +114,7 @@ protected String columnType(int sqlTypeCode) {
111
114
LONG32VARCHAR , LONG32NVARCHAR , LONGVARCHAR , LONGNVARCHAR -> "Text" ;
112
115
case BINARY , VARBINARY , BLOB , LONGVARBINARY , LONG32VARBINARY -> "Bytes" ;
113
116
case JSON -> "Json" ;
117
+ case UUID , YdbJdbcCode .UUID -> "Uuid" ;
114
118
default -> super .columnType (sqlTypeCode );
115
119
};
116
120
}
@@ -119,20 +123,22 @@ protected String columnType(int sqlTypeCode) {
119
123
public void contributeTypes (TypeContributions typeContributions , ServiceRegistry serviceRegistry ) {
120
124
super .contributeTypes (typeContributions , serviceRegistry );
121
125
126
+ typeContributions .contributeJavaType (UUIDJavaType .INSTANCE );
127
+ typeContributions .contributeJdbcType (UUIDJdbcType .INSTANCE );
122
128
typeContributions .contributeJavaType (LocalDateTimeJavaType .INSTANCE );
123
129
typeContributions .contributeJdbcType (LocalDateTimeJdbcType .INSTANCE );
124
130
typeContributions .contributeJavaType (LocalDateJavaType .INSTANCE );
125
131
typeContributions .contributeJdbcType (LocalDateJdbcType .INSTANCE );
126
132
typeContributions .contributeJavaType (InstantJavaType .INSTANCE );
127
133
typeContributions .contributeJdbcType (InstantJdbcType .INSTANCE );
128
- typeContributions .contributeJdbcType (new DecimalJdbcType (YdbJdbcCode .DECIMAL_22_9 ));
129
- typeContributions .contributeJdbcType (new DecimalJdbcType (YdbJdbcCode .DECIMAL_31_9 ));
130
- typeContributions .contributeJdbcType (new DecimalJdbcType (YdbJdbcCode .DECIMAL_35_0 ));
131
- typeContributions .contributeJdbcType (new DecimalJdbcType (YdbJdbcCode .DECIMAL_35_9 ));
132
134
133
135
// custom jdbc codec
134
136
typeContributions .contributeJdbcType (Uint8JdbcType .INSTANCE );
135
137
typeContributions .contributeJavaType (BigDecimalJavaType .INSTANCE_22_9 );
138
+ typeContributions .contributeJdbcType (new DecimalJdbcType (YdbJdbcCode .DECIMAL_22_9 ));
139
+ typeContributions .contributeJdbcType (new DecimalJdbcType (YdbJdbcCode .DECIMAL_31_9 ));
140
+ typeContributions .contributeJdbcType (new DecimalJdbcType (YdbJdbcCode .DECIMAL_35_0 ));
141
+ typeContributions .contributeJdbcType (new DecimalJdbcType (YdbJdbcCode .DECIMAL_35_9 ));
136
142
}
137
143
138
144
@ Override
@@ -141,6 +147,7 @@ protected void registerColumnTypes(TypeContributions typeContributions, ServiceR
141
147
142
148
final DdlTypeRegistry ddlTypeRegistry = typeContributions .getTypeConfiguration ().getDdlTypeRegistry ();
143
149
150
+ ddlTypeRegistry .addDescriptor (new DdlTypeImpl (UUID , "Uuid" , "Uuid" , this ));
144
151
ddlTypeRegistry .addDescriptor (new DdlTypeImpl (YdbJdbcCode .DATETIME , "Datetime" , "Datetime" , this ));
145
152
ddlTypeRegistry .addDescriptor (new DdlTypeImpl (YdbJdbcCode .UINT8 , "Uint8" , "Uint8" , this ));
146
153
ddlTypeRegistry .addDescriptor (new DdlTypeImpl (YdbJdbcCode .DECIMAL_22_9 , "Decimal(22, 9)" , "Decimal(22, 9)" , this ));
0 commit comments