Registering a SQL function with JPA and Hibernate
问题 I would like to know what's the best way to register a custom SQL function with JPA/Hibernate . Do I have to go through extending the MysqlInnodb dialect or is there a better way? Can anyone please provide code samples and pointers to relevant documentation? 回答1: Yes extending the dialect is a good way of registering custom SQL function. Add something like this in your Dialect classes constructor. registerFunction("current_timestamp", new NoArgSQLFunction(Hibernate.TIMESTAMP) );