MySQL "CHARACTER SET" does not work with H2

I use Hibernate + JPA and declare the following field:

@Column(columnDefinition = "MEDIUMTEXT CHARACTER SET utf8")
protected String customData;

The production database is MySQL, but now we are trying to get the H2 database for testing purposes. The problem is that the H2 dialect does not recognize "CHARACTER SET utf8", so I was wondering if there was any way that Hibernate could simply ignore these three words when using the H2 dialect. I tried to expand the dialect and use registerKeyword (), but there is hardly any documentation on this, and I don’t know if this fits right or if I even do it right.

Any help would be greatly appreciated since I cannot change the definition of the column.

+4
source share

Source: https://habr.com/ru/post/1669611/


All Articles