# How to replace registerColumnType when upgrading to hibernate 6

**URL:** <https://discourse.hibernate.org/t/how-to-replace-registercolumntype-when-upgrading-to-hibernate-6/8402>\
**Category:** Hibernate ORM\
**Created:** [October 16, 2023, 9:36am UTC](https://discourse.hibernate.org/t/how-to-replace-registercolumntype-when-upgrading-to-hibernate-6/8402 "2023-10-16T09:36:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gup\_tv](https://avatars.discourse-cdn.com/v4/letter/g/ac8455/32.png) [@Gup\_tv](https://discourse.hibernate.org/u/Gup_tv)\
**Post date:** [October 16, 2023, 9:36am UTC](https://discourse.hibernate.org/t/how-to-replace-registercolumntype-when-upgrading-to-hibernate-6/8402/1 "2023-10-16T09:36:40Z")

</div>

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

```auto
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.
		super();
		registerColumnType(Types.BIT, "tinyint(1)");
	}

}

```

Is there a way to replace registerColumnType?

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [October 17, 2023, 7:19am UTC](https://discourse.hibernate.org/t/how-to-replace-registercolumntype-when-upgrading-to-hibernate-6/8402/2 "2023-10-17T07:19:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Gup\_tv](https://avatars.discourse-cdn.com/v4/letter/g/ac8455/32.png) [@Gup\_tv](https://discourse.hibernate.org/u/Gup_tv)\
**Post date:** [October 18, 2023, 2:34am UTC](https://discourse.hibernate.org/t/how-to-replace-registercolumntype-when-upgrading-to-hibernate-6/8402/3 "2023-10-18T02:34:45Z")

</div>

Thank you, sir. I will try it.
