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.

1
vote
1answer
19 views

jOOQ: Get Referenced Table from Foreign Key

I need to get the referenced table from a ForeignKey but there is no such property. I can get the table but this is useless because it's the table I got the ForeignKey from. Here's an example. What ...
2
votes
1answer
31 views

Information_schema not getting generated from jooq for SQL Server

I am using Jooq Trial for generating code from SQL Server database as a poc. I use the below congifuration. However, it is not generating the information schema during compilation. <...
0
votes
1answer
33 views

No plugin descriptor found at META-INF/maven/plugin.xml in jooq 3.11.11 trial version

I am trying to generate java class from mssql database using jooq. Currently, I'm using trial version to check the feasibility of code generation and am getting the below error. Pls help. [ERROR] ...
1
vote
1answer
18 views

jOOQ: Is there a restriction in the DDLDatabase generator for deferrable constraints?

I'm using the DDLDatabase generator from Gradle to generate jOOQ sources. I seem to have hit a snag when it comes to deferrable constraints. Generating from a live database for the same DDL works... ...
1
vote
1answer
43 views

jooq nested select and type safety

I'm trying to write the following sql in jooq: SELECT SUM(`sum`) AS `total` FROM( SELECT MIN(`num_views`) AS `sum` FROM `fact_wishlist` GROUP BY `id` ) AS t I've ...
0
votes
0answers
19 views

Error:Process 'command '/Library/Java/JavaVirtualMachines/jdkxxx/Contents/Home/bin/java'' finished with non-zero exit value 255

When I use gradle to integrate jooq, it automatically generates pojo. When I execute ./gradlew --rerun-tasks generateUserJooqSchemaSource -Djooq.gensrc=true wrong(sorry my english is not good) I have ...
1
vote
1answer
32 views

Jooq with SQL Server How to select top N results

In our project we are using two databases, one postgres and one mssql. We are using Jooq in order to query these DBs and with postgres everything was pretty straight forward! But with mssql we are ...
0
votes
1answer
22 views

How to create a mock database from csv files for JOOQ?

I have read the the following articles and tried to load data from csv for creating a mock database. https://blog.jooq.org/tag/mock-data/ https://www.jooq.org/doc/3.11/manual/sql-execution/importing/...
1
vote
1answer
41 views

How to return a list of results in jOOQ Mocked Data

I'm using jOOQ's MockDataProvider to mock calls to the database. I've figured out how to return a single record using the information here: https://blog.jooq.org/2013/02/20/easy-mocking-of-your-...
2
votes
1answer
79 views

JOOQ Code Generator skips a class that contains a JsonNode field

I'm currently working on a project that uses JOOQ for the sql transactions with a Postgres. But one of the models has a field of JsonNode type ( jsonb in postgres ). JOOQ code generator does not ...
1
vote
1answer
38 views

Insert data into JSON column in postgres using JOOQ

I have a postgres database to which I read/write using JOOQ. One of my DB tables has a column of type JSON. When I try to insert data into this column using the query below, I get the error ...
3
votes
1answer
36 views

How do I programatically get the jOOQ Table of a Hibernate model?

I am using Hibernate + jOOQ + PostgreSQL. I have a Hibernate model as follows: import javax.persistence.*; @Entity @Table(name="user") public class User { public UUID id; public String email; ...
1
vote
1answer
59 views

How to avoid the NumberFormatException when using a DATETIME column in SQLite?

I am using a SQLite database with tables that include DATETIME columns. jOOQ default binds the DATETIME columns to java.sql.Timestamp. Querying tables with DATETIME columns causes a ...
3
votes
1answer
37 views

How do I use Postgres's to_char in a jOOQ query?

I am trying to convert the following PostgreSQL query to jOOQ: SELECT count(*), to_char(created_date, 'YYYY-MM-DD') as year_month_date FROM log GROUP BY year_month_date ORDER BY year_month_date ...
1
vote
2answers
66 views

How to convert rows to columns in PostgreSQL?

I have two database tables as below site id | name 1 Site One 2 Site Two 3 Site Three asset_quantities id | site_id | asset_type | quantity 1 1 ...
2
votes
0answers
64 views

How to fetch complex model with a result of select statment using fetchgoups and map

I'm using Jooq with Kotlin and i want to write a statement that fetches data from a query that uses couple of tables using join statement(example attached) The problem I'm facing is that I want to ...
2
votes
1answer
52 views

Generate equals and hashCode in Record using tables primary key

Is there a way to tell jOOQ to generate equals() and hashCode() using the primary key of its table? The use case is: I'm using Records in Vaadin Grids. I can refresh single items in the grid but ...
1
vote
1answer
27 views

Is there a way to generate a query string with both inlined and indexed parameters?

On the org.jooq.Query.getSQL(ParamType paramType)method Like ParamType.NAMED_OR_INLINED, but printing ? instead of the named parameter. For example: DSL.select(M3_PUSH.asterisk()) ....
0
votes
0answers
33 views

How can I use JOOQ's insertInto with multiple values? (Sybase Database)

I get an exception when I try to insert multiple values into a Sybase Database with JOOQ: Java Code: dsl.insertInto(ACTIVITY).columns(ACTIVITY.ACTIVITY_NO, ACTIVITY.SUMMARY) .values(1, "summary ...
0
votes
1answer
28 views

jOOQ table generation from existing class

I need to create tables based on existing classes form the library using jOOQ. It's possible to use DB migration scripts (something like V1__first_script.sql) manually. The question: is it possible ...
1
vote
1answer
32 views

Apply Default Values when Instantiating a new Record

I see that jOOQ is also adding the default value to its metadata: public class Kampagne extends TableImpl<KampagneRecord> { this.AKTIV = createField("AKTIV", SQLDataType....
0
votes
1answer
39 views

JOOQ - How to use array_agg with custom type field

I am using Jooq (with PostgreSQL). I need to use array_agg on some query, for aggregating values from a field which is of a custom type. SELECT TABLE.FIELD1, array_agg(TABLE.FIELD2) FROM TABLE GROUP ...
1
vote
1answer
20 views

jOOQ - Reusing SelectConditionStep

I have some code like this: var step = db.select(T1.C1). from(T1). where(T1.C2.eq(v1)); var result = step. and(T1.C3.eq(v2)). fetchOne(); if(result == null) result =...
0
votes
1answer
51 views

jOOQ sets timestamps with local time zone when UTC was expected

In my jOOQ configuration file I have this line: <javaTimeTypes>true</javaTimeTypes> If I create this table in HSQLDB: CREATE TABLE T1 (C1 TIMESTAMP DEFAULT NOW() ON UPDATE ...
1
vote
1answer
18 views

Should I just disable UInteger type on JOOQ?

I've been trying to write some queries (for MySQL) and I'm not sure how to write this particular one that involves Integer and UInteger types: DSL.position(T1.FIELD, ":", -1).eq(T2.UINTFIELD) ...
5
votes
1answer
124 views

jOOQ “IN” Predicate with Degree N Tuples

I need a WHERE clause to check tuples IN a list: (field1, field2) in (('1', 1), ('2', 2), ('3', 3)). This is valid SQL in Postgres. Dialect: POSTGRES jOOQ Version: 3.9.6 What is the correct jOOQ ...
0
votes
1answer
15 views

How do I have a composite field set in JOOQ

I have a query with a composite field set (I don't know what else to call it, pls put in comments what the proper term is so I can update) select name, `value` from docs where ...
0
votes
1answer
54 views

How to store Enum class name and enum value in database

I have a class with different enums, for example: class EligibilityRule{ ProductEligibility productEligibility; CountryEligibility countryEligibility } enum ProductEligibility{ PRODUCT_X, PRODUCT_Y }...
0
votes
1answer
51 views

JDBC connection closes unexpectedly

I'm getting the following error from time to time and I can't figure out why: org.jooq.exception.DataAccessException: SQL [select "public"."RefreshTokens"."userId" from "public"."RefreshTokens" where ...
0
votes
0answers
23 views

JOOQ - batch execution in one query with on conflict update

I want to do batch execution in one query , like this : create.batch(create.insertInto(AUTHOR, ID, FIRST_NAME, LAST_NAME ).values((Integer) null, null, null)) .bind( 1 ,...
0
votes
0answers
39 views

Migrate from async-jdbc to reactive-pg-client over VertX and Jooq

I need to migrate the database access layer of my VertX application. Now I'm using async-jdbc and jooq together over this library jklingsporn/vertx-jooq. Until now, the custom jooq generator from ...
0
votes
1answer
25 views

Specify fields without table

On jOOQ's homepage there's this nice example: create.select(BOOK.TITLE) .from(BOOK) .where(BOOK.PUBLISHED_IN.eq(2011)) .orderBy(BOOK.TITLE) Is there a way to make it more concise? I'm thinking ...
0
votes
1answer
26 views

Skipping Gradle task dependencies if that task is up to date

I am trying to migrate a build to gradle, and I have one issue hanging me up with the build cache. I have a set of dependent tasks that are used to: setup an embedded MySQL server migrate the schema ...
2
votes
1answer
159 views

Inserting image to BYTES column - type “binary” does not exist

I'm trying to insert an image from Spring's MultipartFile field into Postgres' BYTEA column with jOOQ but I keep getting confusing error message. What does it mean and how the insert should be done? ...
1
vote
1answer
34 views

Caching Sequence from database to reduce db calls

we are developing batch application using JOOQ. Application requires to call sequence to get next value for persisting large number of records. This will definitely be overhead to the performance. ...
1
vote
0answers
48 views

JOOQ - Get temp table from meta()

I have some code that creates a table, then a different code tries to load a Table<?> instance given that table name, using DSLContext.meta() Create Table DSLContext db = getDslContext(...
0
votes
0answers
34 views

How to properly use a POJO enum in mysql via jooq

I am trying to reduce a bit of tech debt that we have in a code base. This involves having to write the same bit of stuff twice every time an "action" is added to our possible list of enums, which ...
0
votes
2answers
37 views

How to convert an Epoch to a OffsetDateTime in Kotlin?

The postgresql Timestamp with Time Zone data type needs to be supplied an OffsetDateTime when being called using a High level language like Kotlin. I could not find a direct method that supports ...
0
votes
1answer
63 views

(JOOQ) When I try to compile project get connection error with Mysql

When I try to compile project written on Spring-Boot, Jooq and MySql get this error: [ERROR] Failed to execute goal org.jooq:jooq-codegen-maven:3.11.11:generate (default) on project myapp: Error ...
0
votes
2answers
38 views

Perform SQL statement after each DELETE

Is there a way to make jOOQ perform a SQL statement (in my case a CHECKPOINT) after each DELETE? Ideally there would also be a way to specify the tables that this happens for. The RDBMS I'm using (...
0
votes
0answers
43 views

jOOQ converter from String to List<MyType> in Kotlin

I'm working on a rare case where I find storing JSON in a RDBMS field acceptable. JSON document is an array or key-value objects. So, the jOOQ converter converts from String to List<MyType>. I'...
1
vote
1answer
39 views

Why does Jooq code-generation break with PostGIS?

Context - I am trying out Postgres' Geographic Information System extension PostGis that enables stories latitude and longitudes as Point and operations on it. If I understand correctly then I need ...
0
votes
1answer
102 views

When I try to compile project get `Error with jOOQ code generation tool`

Failed to execute goal org.jooq:jooq-codegen-maven:3.11.11:generate (default) on project myapp: Error running jOOQ code generation tool <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:...
0
votes
1answer
35 views

Getting null pointer exception while mapping the jooq record into an object

I have a couple of JOOQ repositories which fetch the data from the Postgres DB and provides the data as value objects. I was using JOOQ 3.10.7 and everything working fine. I have upgraded my spring-...
2
votes
1answer
339 views

How do SQL dialects actually work internally in frameworks like hibernate and JOOQ

As we have seen that after you get a data source. We need to configure SQL dialects based on the database we use. After we select a particular dialect, How would that be used to make SQL queries ...
0
votes
0answers
29 views

Modelmapper, with Jooq integration, to map and unmap immutable objs using Builders only

Modelmapper always assumes the presents of POJO's getters/setters. I'd like to map complex immutable objs from and to immutable ojbs using the full(Lombok in my case) builders approach. How to ...
1
vote
1answer
43 views

Returning id in generic insert using JOOQ

I have a very generic API to insert stuff using JOOQ to soem tables: void insert(@NonNull final Table<?> table, @NonNull final Collection<Field<?>> columns, ...
0
votes
0answers
19 views

Flaky test using an embedded Mysql DB

I've written an integration test that uses a Mysql embedded database. When I execute the test class on my IDE, the tests executes successfully along with the other integration tests that appear in the ...
1
vote
1answer
68 views

How to resolve ambiguous match when chaining generated Jooq classes

I have defined my models in JPA and am writing some queries for my application and I am using JOOQ generated classes to join all the tables together to check if the requested resources actually belong ...
0
votes
0answers
11 views

How can I get the jooq generation codes in my mac?

I use jooq to generate code in my Mac, but it generate nothing. my environments is list as follow, jooq: 3.11.11 mac: 10.13.6 java: 1.8 mysql: 5.1.47 The configuration file is list as follow, <?...