I was testing different ways of data retrieval from my database (MySQL) using Hibernate. And I get to know that it is possible to use LIKE in HQL just like we do it in SQL. But when I tried REGEXP I got the following error I have also tried the different forms like RLIKE and REGEXP_LIKE. But the error is
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:
Liquibase bidirectional relationships changelog order
I’ve faced a problem when implementing liquibase in an existing project. So we have two entities: Company: Stock: And my liquibase changelogs. Company: Stock: And master: I have this exception: I understand that liquibase trying to create stock and then add company_id as foreign key although there is no company table yet. I have a bunch of bidirectional relationships and
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 module to both code generation and runtime
In Jooq, how to make the “delete” statement return the deleted records?
In my project, there are 2 tables, orders and order_payments. The latter is a join table with 2 columns, order_id and payment_id. I didn’t use FK for efficiency sake. When I delete some orders from orders table, I need to delete the related records from payments table based on the order_id field. So, after the orders are deleted using the
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_id and user_id as null so I
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 from sql query?
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 inline using
Case insesitive query with Springboot CRUD Repository
Values in Room_Entity table is hardcoded and Room_Status values are in uppercase . I want my search to be case insensitive. Here is my query. I am using upper but getting error @Query(value = “…