Questions tagged [jooq]

jOOQ stands for JOOQ Object Oriented Querying. jOOQ effectively combines complex SQL, typesafety, source code generation, active records, stored procedures, advanced data types, and Java in a fluent, intuitive DSL.

Filter by
Sorted by
Tagged with
0 votes
0 answers
4 views

Customize class name of generated jooq enum

I'm using jooq 3.18 and I would like to generate enum classes but with a prefix or postfix to avoid name clashing in my project. Is it possible to customize to the generation of enums? I'm aware of ...
  • 41
1 vote
1 answer
33 views

How can I implement row-level security with jOOQ?

I found this question, and this blog post. I'm not sure if this is relevant anymore (some deprecated code) and there might be a new and better way to do this. Is there a way to add a condition to ...
  • 175
0 votes
1 answer
16 views

Insert a record with where clause using jooq

I'm streaming master data and want to be able to process only data that are intended to. Therefore I'm fetching data from another table while inserting the data. Using Jooq it currently looks like: ...
  • 609
1 vote
1 answer
43 views

Quickperf @ExpectUpdate does not recognise configured batch size of Jooq

I am replacing the usage of JDBC Template with Jooq. For example, to batch update entities in a database. Against this I am running unit tests that use Quickperf annotations, as @ExpectUpdate. The ...
1 vote
1 answer
39 views

Implementing Interfaces with Generics in Jooq

I have several dozen generated JOOQ tables representing views in my MySQL database, all with matching columns. I want to operate on these views generically - so I used a generator strategy below to ...
3 votes
1 answer
128 views

jOOQ Converter for NOT NULL column: Why is it necessary to handle null if the column cannot be null?

In jOOQ code generation, it is possible to assign a converter to a NOT NULL field like so: <forcedType> <includeTypes>(?i)^varchar\(\d+\)$</includeTypes> <userType>...
1 vote
1 answer
28 views

How can I combine Query#getSQL() and Query#getBindValues() to make a "JOOQless" query?

The jOOQ documentation explains how to use it as a query builder: https://www.jooq.org/doc/latest/manual/getting-started/use-cases/jooq-as-a-sql-builder-without-codegeneration/ I would like to go a ...
  • 137
0 votes
1 answer
17 views

JOOQ parsing issue postgres bitwise and (&)

I have a postgres SQL where case when (column1 & 64) <> 0 then 1 else 0 end as aliasxyz It's throwing Caused by: org.jooq.impl.ParserException: Token ')' expected:
  • 2,203
0 votes
2 answers
34 views

How to remove POJO class name from the output string?

I have below POJO package com.beans.test; import lombok.Data; @Data public class Person { private int id; private String name; private Integer age; private Boolean isEmployed; ...
-2 votes
0 answers
17 views

How can I fix a build error with Jooq (generate step)?

I'm trying to implement Jooq in my backend project I have an error without logs .... Could you explain to me what is happening? I just know that he managed to connect to the database. Thanks in ...
1 vote
1 answer
194 views

Using JOOQ DSLContext.transactionResult with setLocal

I am trying to set a local variable on Postgresql by using reactive way inside dslContext.transactionResult. I want to keep the user_id, the id of the user who changed the product table, in the ...
1 vote
1 answer
27 views

Jooq and PSQLException

I am trying to fetch records with nasted childs in it but get PSQLException syntax error and org.jooq.exception.DataAccessException. record ChildRecord(Integer parentId) {} record ...
3 votes
1 answer
37 views

Use $$ in dollar quoted string with jOOQ

I am trying to update a column with jOOQ in a block statement. My Kotlin code looks like this (newName and id are Kotlin variables): dslContext.begin( ..., dslContext.update(MYTABLE).set(...
1 vote
2 answers
51 views

How to mock a jOOQ result in Spock

I'm working in a Spring Boot app, I have a Groovy class: @Component class MyClass { DSLContext jooq MyClass(DSLContext jooq) { this.jooq = jooq } void execute(String value) {...
  • 337
0 votes
0 answers
30 views

how do I make JOOQ + Gradle work in Spring boot?

https://www.jooq.org/doc/latest/manual/code-generation/codegen-gradle/ I use JOOQ, Spring boot, MySql, Gradle. From here I was able to make my build.gradle script which builds successfully but doesn't ...
0 votes
1 answer
29 views

multiple nested to one relationship in jooq

I'm using JOOQ 3.17.6 with Kotlin and can't figure out how can I retrieve and populate A->B->C relationships. Given some classes Foo->Bar->Baz data class Foo( val fooName: String, val ...
  • 220
1 vote
1 answer
25 views

how use JOOQ plain SQL templating?

postgres query : select * from message t where "address" = decode('0x159159159526212521','escape') develop code : Field<String> address = val("0x159159159526212521"); Field&...
  • 41
1 vote
2 answers
51 views

jOOQ Multiset Operator returns nested JsonArray on query

For context, we are using jooq 3.17 and vertx-jooq 6.5.5 inside Quarkus. As a consequence, everything is a Mutiny stream. We cannot use blocking operations (like fetch()). As proposed in the official ...
  • 1,936
2 votes
1 answer
38 views

JOOQ H2 (DDLDatabase) code generaton fails because KEY is a reserved word

In newer versions of H2, KEY is a reserved word. JOOQ code generation following this doc fails because we have KEY as column name in some tables: Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: ...
  • 2,684
2 votes
1 answer
37 views

Why doesn't Jooq recognise the type?

I have an enum SomeType with following structure: enum class SomeType { Type1, Type2 } I also have a table with that enum: create type users.some_type as enum ('Type1','Type2'); create table ...
2 votes
1 answer
28 views

JOOQ: ad-hoc converters ignored in union query with multiple converters

It seems when running a union query with multiple converters, the second ad-hoc converter is ignored. For example: record A(UInteger id, String name) implements Something { }; record B(UInteger id, ...
1 vote
1 answer
198 views

Jooq and Hibernate (n+1) problem while map into Dtos

We want to integrate together with Hibernate, so idea is to use Jooq as a complex query generator. I saw a lot of examples that is describe in JOOQ Official example But I didn't manage to solve the n+...
1 vote
1 answer
31 views

Nesting MULTISET/ROW/MULTISET/ROW with ad-hoc converters and JSON emulation results in ClassCastException

When performing a select which includes a subquery in multiselect, which itself performs a subquery in a multiset, I would expect the result to have the expected type. Instead, the nested result ...
1 vote
1 answer
30 views

JOOQ interpreting JSONB as JSON when generating from script

I'm using JOOQ with Postgresql, where I have a few columns of the JSONB type. Using the JOOQ code generator directly on the database itself (using org.jooq.util.postgres.PostgresDatabase) works just ...
  • 37
1 vote
1 answer
42 views

How to bind dynamic column names as Field?

Using jOOQ 3.16 and SQLDialect.MYSQL, I would like to set up parameter binding for a list of dynamic column names. I am using jOOQ as a query builder only. So far the closest I got is select(field(...
1 vote
1 answer
27 views

How to respect DEFAULT values when using JOOQ generated UpdatableRecordImpl from() method

It seems that there had been some work to respect default values when using DAO inserts/updates here: https://github.com/jOOQ/jOOQ/issues/2700. This is great, however I'm struggling to take advantage ...
  • 340
1 vote
1 answer
23 views

Jooq bind the same parameter multiple times

I have an SQL query that uses the same parameter in several places (the table name changed between the environments prod, stg, dev): String SQL = select * from :a_table a join :b_table b on a.x != b.x ...
  • 127
1 vote
1 answer
18 views

Define dynamically what columns to update in jOOQ

I have this jOOQ example that could either update COLUMN_A or COLUMN_B context.update(MY_TABLE) .set(MY_TABLE.COLUMN_A, fieldA) .where(MY_TABLE.SK.eq(sk)) .execute(); context....
  • 1,113
1 vote
1 answer
21 views

Jooq choose when statement on multiple columns

I have this part of query: case when columnA = 'On' and columnB <= current_date() and columnC > current_date() then columnA else 'NoChange' end) is it ...
  • 127
1 vote
1 answer
68 views

Difference between using JDBC and R2DBC connection for Jooq

The documentation for Reactive Fetching in Jooq mentions: Out of the box, all jOOQ provided publishers will block on the underlying JDBC connection, but if you provide jOOQ with a io.r2dbc.spi....
2 votes
2 answers
25 views

Jooq & R2DBC execute DDL

I have my tables schema generated from the database, I'm trying to execute the ddl to create the tables using an r2dbc connection to an h2 in memory, but I cannot figure out what should I do. The ...
  • 8,860
1 vote
1 answer
65 views

How to write nested sql query in jooq with SUM operation in SELECT

I have a nested sql query and I want to write that query in jooq. select organisation_name, sum(api_status = 'COMPLETED') as success_count, sum(api_status <> 'COMPLETED') as failure_count, count(...
1 vote
1 answer
29 views

How to add Oracle dialect to DSLContext

I'm not able to get SQLDialect.Oracle in the following version of jOOQ: <dependency> <groupId>org.jooq</groupId> <artifactId>jooq</artifactId> <version>...
  • 5,393
0 votes
1 answer
46 views

How to write nested query in jooq with SUM operation from the subquery output?

Let's say I want to find out the sum of one of the table from the nested subquery. Let's take the subquery given below. How to calculate the status count using DSL.sum(when(condition)) Table<...
1 vote
1 answer
24 views

jOOQ: MySQL "TEMPORARY TABLE" does not exist during transaction?

I have code like the following: fun <T> withTempTableTxn( ctx: DSLContext, tempTableSelectAs: org.jooq.Select<*>, txnBlock: (DSLContext, org.jooq.Name) -> T, ): T { val ...
  • 478
0 votes
1 answer
52 views

Jooq: JsonConverter not converting jsonb into list of class when fetching data

This is a continuation of a first question I asked here: Jooq: How can I map a JSONB column to a Kotlin data class field? Although I'm able to create new records just fine with the changes mentioned ...
2 votes
1 answer
30 views

Jooq resolves unnest / table to union all (Oracle)

I'm using jOOQ to delete a variable number of rows from an Oracle database: List<Integer> ids = Lists.newArrayList(1, 2, 3, 4); db.deleteFrom(MESSAGE) .where(MESSAGE.ID.in(ids)) ....
  • 722
1 vote
2 answers
70 views

Jooq: How can I map a JSONB column to a Kotlin data class field?

I have this table that has a metadata jsonb column, that's supposed to be a json array of data about other tables/PKs. I am able to insert rows into the database, but am having a hard time mapping the ...
0 votes
1 answer
24 views

Getting error while implementing joins on multiple DSL contexts from different databases in jooq

I want to execute one query having joins with the tables related to different DSLCONTEXT which are related to different databases.Below is the example of what I am trying to do : DSLContext ctx1; ...
1 vote
1 answer
38 views

Implement interface in POJO if contains field

I generate java classes with jOOQ. And I want to make POJOs implement an interface which contains only getters for fields. Obviously, I need this interface only in POJOs with such fields. I need check ...
  • 13
1 vote
1 answer
15 views

Jooq Liquibase dependencies between modules and tables

I have a multi-maven module project and I have two modules that contain some Liquibase configuration with tables. I want to add a foreign key between two tables but table A is in module A and table B ...
  • 424
1 vote
1 answer
34 views

Does Jooq integrate with JPA Transactions?

I'm trying to figure out Jooq 3.17 transaction semantics when used in a Spring Boot application that already uses Hibernate. I read the Jooq docs on this: https://www.jooq.org/doc/latest/manual/sql-...
  • 1,026
0 votes
0 answers
20 views

I use jooq 3.16.5, I get Indexes from Data table by dslContext.meta() But get Index with Sorted Fileld NullOrdering null

implementation 'org.jooq:jooq:3.16.5' implementation 'org.jooq:jooq-meta:3.16.5' implementation 'org.jooq:jooq-codegen:3.16.5' implementation 'org.springframework.boot:spring-boot-starter-jooq:3.0.1' ...
1 vote
1 answer
21 views

Configuring jOOQ to use the Kotlin IO dispatcher

The default executor in jOOQ uses the ForkJoinPool common pool by default, or plain unmanaged threads when only one CPU is available: Since I use a standard blocking JDBC driver (as opposed to an ...
  • 16.7k
1 vote
1 answer
21 views

JOOQ Does Not Respect Default Value Inside the generated POJO's

I'm trying to create a new schema with a new column with a default value not null. Somehow in the generated DAO, I can see that JOOQ doesn't respect and delegate the default value. Would you happen to ...
2 votes
1 answer
38 views

Difference between fetch().stream().findFirst() vs fetchAnyInto

Can someone let me know what is the difference between the below queries? If both are same which one should be preferred over the other? Query 1 dslContext .selectFrom(AIR_TRANSACTION) ...
  • 5,668
1 vote
1 answer
40 views

Jooq multiset referencing foreign key relationship

I'm working off the example from the jooq blog post: https://blog.jooq.org/jooq-3-15s-new-multiset-operator-will-change-how-you-think-about-sql/. I've got the same setup: a foreign key relationship, ...
  • 1,026
1 vote
3 answers
125 views

Is there a way to generate jooq code from flyway migrations?

I have a kotlin spring boot application which is using Jooq. My database is postresql and I have flyway migrations configured for it. The problem is that when I am in my dev environment there is no ...
  • 81
1 vote
1 answer
55 views

JOOQ doesn't return auto generated value for normal column

I have table user_profile, with 3 fields: id: UUID, primary key, not null, auto generated created: TIMESTAMP, not null, auto generated name: VARCHAR Below is my code to insert a new row to the table....
  • 529
1 vote
1 answer
22 views

Configure the org.jooq.conf.Settings.backslashEscaping property

In the book "Beginning jOOQ" by Tayo Koleoso it is written: Caution For your own peace of mind, go ahead and configure the org.jooq.conf.Settings.backslashEscaping property on your Settings ...
  • 3,371

1
2 3 4 5
50