Upgrading the following code from quarkus 2.0.x to 3.0.x resulting in the deprication of the method: registerColumnType. How to refactor this code, to make this work with 3.0?
public class H2CustomDialect extends H2Dialect {
public H2CustomDialect() {
super();
registerColumnType(Types.BINARY, "varbinary");
}
}
First, don't upgrade to 3.0, but to 3.3. 3.2 if you must. But 3.0 is no longer maintained.
Second, what you're doing is weird. You're basically telling Hibernate ORM to use the VARBINARY type everywhere it would use BINARY, even though you could just have told it to assign VARBINARY to whatever Java types or properties you have in your application. See here for type mappings, here for configuring a MetadataBuilderContributor
in Quarkus to register your type mappings.
Finally, if you really must do it, something like this might work:
public class H2CustomDialect extends H2Dialect {
public H2CustomDialect() {
super();
}
@Override
protected void registerColumnTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
super.registerColumnTypes( typeContributions, serviceRegistry );
ddlTypeRegistry.addDescriptor( Types.BINARY, ddlTypeRegistry.getDescriptor( Types.VARBINARY ) );
}
}
I really don't think that's a good idea, though.