Skip to content

Tag: sql

How to add multiline Strings in Java?

How to make long queries more readable? For example I have this one: And it’s completely unreadable, are there any ways to beautify it? Answer Since Java 15, you can use text blocks:

JOOQ materialized views

is it possible to create materialized views using the JOOQ builder? Something like this Answer In jOOQ 3.14, not yet: https://github.com/jOOQ/jOOQ/issues/9483 But you can use plain SQL templating to work around this limitation, to at least get some type safety in your statement:

Is there a way to query ltrees in JOOQ?

Is there any sort of extension that would allow me to use Postgres ltrees in JOOQ without having to use raw SQL? Any way to make one myself maybe? Answer Starting from jOOQ 3.17: With #13188, jOOQ has added native support for LTREE types (and similar) via the jooq-postgres-extensions module: Just add that mod…

Is there way to set default as null for SQL parameter?

I have a code that creates sql parameters using MapSqlParameterSource. Here is my code: Basically, if account type is spoofer, I have to have user id instead of account id. However, I don’t like that I have to set account_id and user_id to null when I instantiate parameters. Is there way to set account_…

JPA SQL Result Mapping

my code is mapping query result to DTO using Sql Result Mapping and create list with these dtos but in my database id can be null and it gives me trouble in mapping. That’s why I don’t want to use it instead of that, is there any way to generate id’s for these dto’s not getting them fr…

JOOQ – inline Converter not being applied

In my build.gradle I use a converter in my forcedTypes. This works fine where i need it. However, I am trying to convert a comma separated string into a list of enums for a specificuse case: This throws an exception This is the model I am fetching into: Am I missing something? UPDATE: I am able to convert inl…