I a trying to write below query in querydsl
SELECT u.id
FROM users AS u
JOIN unnest(ARRAY[2,2,1]) WITH ORDINALITY AS arr(elem, ord)
ON u.id = arr.elem
ORDER BY arr.ord;
How can I join on array if ids
I tried registering unnest function too
public class Contributor implements MetadataBuilderContributor {
@Override
public void contribute(MetadataBuilder metadataBuilder) {
metadataBuilder.applySqlFunction("unnest",
new SQLFunctionTemplate(StandardBasicTypes.STRING, "array[?1]"));
}
}
But this is also not working, I am getting unexpected token: unnest