package com.atlassian.stash.internal.hibernate.dialect;

import org.hibernate.dialect.SQLServer2012Dialect;

import java.sql.Types;

/**
 * Overrides the types for {@code CHAR}, {@code CLOB}, {@code LONGVARCHAR} and {@code VARCHAR} to use Unicode-ready
 * SQL types.
 *
 * @since 2.1
 */
public class CustomSqlServer2012Dialect extends SQLServer2012Dialect {

    public CustomSqlServer2012Dialect() {
        registerColumnType(Types.CHAR, "nchar($l)");
        registerColumnType(Types.CLOB, "nvarchar(MAX)");
        registerColumnType(Types.LONGVARCHAR, "nvarchar(MAX)");
        registerColumnType(Types.VARCHAR, "nvarchar(MAX)");
        registerColumnType(Types.VARCHAR, 4000, "nvarchar($l)");
    }
}
