I assume that it is not possible
Indeed it isn’t.
I think this is a really big step backward. Many DBMS’ offer a variety of functions that provide crucial and enhanced functionality
You can always use native queries, or even plain JDBC to take advantage of these “variety of functions”. They are beyond Hibernate ORM’s scope and objective, which is to provide an easy to use and cross-functional interface from Java to all supported databases.
I couldn’t find any examples that showcase how to create an implementation for non trivial functions (like
round
, which can have different return types depending on its parameter).
The Hibernate source code has plenty of these examples, here’s the return type resolver for one, or the PostgreSQLTruncRoundFunction
implementation for a complete function support.
Note that you don’t need to re-implement everything, through the function contributor serivce you can simply write something like:
functionContributions.getFunctionRegistry().namedDescriptorBuilder( "make_interval" )
.setExactArgumentCount( 1 )
.setParameterTypes( ... )
.setInvariantType(functionContributions.getTypeConfiguration().getBasicTypeRegistry().resolve(StandardBasicTypes.DURATION))
.register()