mysql - SEPARATOR keyword not working properly in Hibernate Formula -
i have following hibernate forumla query, able execute in mysql workbanch.
select group_concat(distinct t.column_1_name separator ', ') table_name t , t.fk_record_id = record_id
while executing query hibernate, hibernate appending parent table seprator key word shown in below query.
select group_concat(distinct t.column_1_name parent_table.separator ', ') table_name t , t.fk_record_id = record_id
here hibernate not treating seprator keyword. has idea this?
you can add separator
keyword. implement own dialectresolver
, add keyword in lower case resulting dialect:
public class mydialectresolver extends standarddialectresolver { protected dialect resolvedialectinternal(databasemetadata metadata) throws sqlexception { dialect dialect = super.resolvedialectinternal(metadata); dialect.getkeywords().add("separator"); return dialect; } }
you have tell hibernate use dialect resolver. example in jpa can in persistence.xml:
<persistence> <persistence-unit> ... <property name="hibernate.dialect_resolvers" value="mypackage.mydialectresolver"/> </persistence-unit> </persistence>
btw: same applies aggregating functions in other dialects. example in oracle within
keyword missing.
Comments
Post a Comment