view src/main/java/org/mpi/openmind/repository/utils/CustomMysqlDialect.java @ 89:8adfa8679991

new implementation of translit-to-romanization rules in RomanizationLoc with test(!).
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Mon, 26 Feb 2018 14:39:49 +0100
parents 1cd9d9a67cad
children
line wrap: on
line source

package org.mpi.openmind.repository.utils;

import org.hibernate.Hibernate;
import org.hibernate.dialect.function.SQLFunctionTemplate;

public class CustomMysqlDialect extends org.hibernate.dialect.MySQLDialect {

    
    public CustomMysqlDialect() {
        super();
        
        /**
         * Function to evaluate regexp in MySQL
         */
        registerFunction("regexp", new SQLFunctionTemplate(Hibernate.INTEGER, "?1 REGEXP ?2"));    }

    public String getTableTypeString() {
        return " ENGINE=InnoDB DEFAULT CHARSET=utf8";
    }
}