How to replace registerColumnType when upgrading to hibernate 6

I am trying to migrate from Hibernate 5 to 6 and I am a bit stuck with following code:

public class MySQL8DialectBitFixed  extends MySQL8Dialect  {
	public MySQL8DialectBitFixed () {
		// This class is being added b/c hibernate/MySQL doesn't work with boolean fields in the db.
		// The data is not persisted properly.
		registerColumnType(Types.BIT, "tinyint(1)");


Is there a way to replace registerColumnType?

You can override MySQLDialect#columnType and do a if (sqlTypeCode == java.sql.Types.BOOLEAN ) { return "tinyint(1)"; }, but I would recommend you to just try the out of the box dialect instead of fiddling around with it.

1 Like

Thank you, sir. I will try it.