When executing an entity query (e.g. JPQL, HQL or Criteria API), you can use any SQL function without having to register it as long as the function is passed directly to the WHERE clause of the underlying SQL statement.
However, if the SQL function is used in the SELECT clause, and Hibernate has not registered the SQL function (be it a database-specific or user-defined function), you will have to register the function prior to using it in an entity query.
In this article, you are going to learn various ways to register SQL functions with JPA and Hibernate.
Continue reading “The best way to use SQL functions in JPQL or Criteria API queries with JPA and Hibernate”
One of my Twitter followers asked me if there is any documentation for bootstrapping JPA programmatically so that we can replace the
persistence.xml configuration file with a Java configuration:
Previously, I wrote an article about bootstrapping Hibernate without the
persistence.xml, but that solution was based on the Hibernate-specific
In this article, I’m going to give you a solution that works with any JPA provider since it’s based on standard Java Persistence API.
Continue reading “How to bootstrap JPA programmatically without the persistence.xml configuration file”