数据库特有的SQL语法跟HQL有冲突怎么办
更多个人技术分享,请访问http://www.derekchou.com
MySQLExtendDialect.java
/** * MySQLExtendDialect.java of new_dlog_cn */ package com.dlog4j.tester; import org.hibernate.Hibernate; import org.hibernate.dialect.*; import org.hibernate.dialect.function.SQLFunctionTemplate; /** * MySQL扩展方言 */ public class MySQLExtendDialect extends MySQLDialect { public MySQLExtendDialect(){ super(); registerFunction("convert_gbk", new SQLFunctionTemplate(Hibernate.STRING, "convert(?1 using gbk)") ); } }