How can you call custom database functions with Hibernate?

If you want to use your custom function in HQL, you’ll need to define it in appropriate Dialect

Take a look at PostgreSQLDialect (or any other, really) source, and you’ll see a bunch of registerFunction() calls. You’ll need to add one more 🙂 – for your own custom function.

You’ll then have to specify your own dialect in Hibernate configuration.

Leave a Comment