How can you call custom database functions with Hibernate?

前端 未结 2 826
孤独总比滥情好
孤独总比滥情好 2020-11-27 06:00

If I were to define some function in the database (perhaps Postgres, or any other database):

create or replace function isValidCookie(ckie);
<
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-27 06:21

    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.

提交回复
热议问题