Skip to content

Commit c21568f

Browse files
cigalybeikov
authored andcommitted
HHH-18869 Override Dialect.equivalentTypes in MariaDBDialect to return true for JSON vs LONGTEXT
See https://mariadb.com/kb/en/json-data-type/
1 parent de8a565 commit c21568f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

hibernate-core/src/main/java/org/hibernate/dialect/MariaDBDialect.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import java.sql.DatabaseMetaData;
88
import java.sql.SQLException;
9+
import java.sql.Types;
910

1011
import org.hibernate.boot.model.FunctionContributions;
1112
import org.hibernate.boot.model.TypeContributions;
@@ -313,4 +314,11 @@ public IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, D
313314
public String getDual() {
314315
return "dual";
315316
}
317+
318+
@Override
319+
public boolean equivalentTypes(int typeCode1, int typeCode2) {
320+
return typeCode1 == Types.LONGVARCHAR && typeCode2 == SqlTypes.JSON
321+
|| typeCode1 == SqlTypes.JSON && typeCode2 == Types.LONGVARCHAR
322+
|| super.equivalentTypes( typeCode1, typeCode2 );
323+
}
316324
}

0 commit comments

Comments
 (0)