I\'m using JPA query in my current spring-boot project. How can I add non-standardized SQL functions like GROUP_CONCAT?
Prior, to my previo
In case someone is having issues when registering this in a SpringBoot app this is the right way:
Create a class that implements: MetadataBuilderContributor interface.
package com.application.config;
public class SqlFunctionsMetadataBuilderContributor implements MetadataBuilderContributor {
@Override
public void contribute(MetadataBuilder metadataBuilder) {
metadataBuilder.applySqlFunction(
"STRING_AGG",
new StandardSQLFunction(
"STRING_AGG",
StandardBasicTypes.STRING
)
);
}
}
In your application .yml (or .properties) refer to the previously created class in the following properties path: spring.jpa.properties.hibernate.metadata_builder_contributor
spring:
jpa:
properties:
hibernate:
metadata_builder_contributor: com.application.config.SqlFunctionsMetadataBuilderContributor