View source | View content page | Page history | Printable version   

Projects:Register SQL Functions/Specs


The goal of this project is to provide a new mechanism to register SQL functions to be used in HQL, and deprecate the current method intended for this purpose, which is no longer supported in newer Hibernate versions.

The main objective is to provide this new mechanism before the introduction of the Hibernate upgrade, in order to minimize the impact of all the changes involved in that project.

Current Status

The current way of registering SQL functions is done by calling the OBDal.registerSQLFunction(String, SQLFunction) method. This method assumes that it is possible to register SQL functions in Hibernate at runtime. This is no longer possible in newer Hibernate versions where it is only possible to register SQL functions when Hibernate is being initialized.

See here and here for additional information.

New Registering Infrastructure

Currently, there exists different ways to register SQL functions in Hibernate:

The solution to be implemented will be based on the second approach, i.e., by taking the Hibernate configuration and register the SQL functions directly on it. This is one of the recommended approaches in the Hibernate 5.3.0 User Guide and also very feasible to implement in Openbravo.

Therefore, to implement this solution the SessionFactoryController will provide a new method that will return the list of SQL functions to be registered with the Configuration class provided by Hibernate. This new method will be overridden by those classes extending the SessionFactoryController.

In particular, the DalSessionFactoryController will override this method, retrieving the SQL functions to be registered using CDI. Thus, it will provide the ability for registering the core SQL functions but it will also allow adding new ones with external modules.

Retrieved from ""

This page has been accessed 621 times. This page was last modified on 14 May 2018, at 15:27. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.