getTypeName method when updating from Hibernate core v5 to v6

25 views Asked by At

My application has CustomDialect extending SQLServerDialect. I'm trying to update this application dependencies hibernate-core from v5 to v6. My custom Dialect looks something like this: CustomDialect

public class SQLServerNativeDialect extends SQLServerDialect {
     public SQLServerNativeDialect() {
         super();
         registerColumnType(Types.CLOB, "nvarchar(max)");
     }

    public String getTypeName(int code, int length, int precision, int scale) throws HibernateException {
        if(code != 2005) {
            return super.getTypeName(code, length, precision, scale);
        } else {
            return "ntext";
        }
    }
}

When I updated my dependency, I received an error with registerColumnType and super.getTypeName methods.

For the registerColumnType, I found solution from hibernate community threads. replace registerColumnType

@Override
protected string columnType(int sqlTypeCode) {
  switch (sqlTypeCode) {
    case Types.CLOB:
      return "nvarchar(max)";
    default:
      return super.columnType(sqlTypeCode);
  }
}    

But I couldn't get any information on the getTypeName method. Is there any equivalent methods for this in hibernate v6?

Thanks in advance.

0

There are 0 answers