我正在尝试从Hibernate 5迁移到Hibernate 6,但遇到了以下代码:
import org.hibernate.dialect.MySQL57Dialect
import org.hibernate.dialect.function.SQLFunctionTemplate
import org.hibernate.dialect.function.StandardSQLFunction
import org.hibernate.type.StandardBasicTypes
import org.hibernate.type.StringType
import java.sql.Types
class CustomMySQLDialect : MySQLDialect(DatabaseVersion.make(5, 70)) {
init {
registerFunction("group_concat", StandardSQLFunction("group_concat", StringType()))
registerFunction("match_against", SQLFunction(StandardBasicTypes.DOUBLE, "match (?1) against (?2 in boolean mode)"))
registerHibernateType(Types.FLOAT, StandardBasicTypes.DOUBLE.name)
registerHibernateType(Types.BIGINT, StandardBasicTypes.LONG.name)
registerHibernateType(Types.TINYINT, StandardBasicTypes.LONG.name)
registerHibernateType(Types.INTEGER, StandardBasicTypes.LONG.name)
registerHibernateType(Types.DECIMAL, StandardBasicTypes.LONG.name)
}
}
看起来registerFunction
和registerHibernateType
已经被移除了,它们的替换并不是微不足道的。有没有办法简单地解决这个问题呢?
编辑:我添加了进口以进行澄清。
1条答案
按热度按时间bihw5rsg1#
第二部分可按如下方式处理: