jooq

Jooq not returning primary key after store, on sqlite

前提是你 提交于 2019-12-11 07:44:14
问题 I'm using Gradle and https://github.com/etiennestuder/gradle-jooq-plugin, configured like that jooq { version = '3.10.6' foo(sourceSets.main) { jdbc { url = "jdbc:sqlite:${projectDir.absolutePath}/foo.sqlite" } } } I have the following dependencies of interest jooqRuntime 'org.xerial:sqlite-jdbc:3.21.0.1' compile 'org.xerial:sqlite-jdbc:3.21.0.1' My foo DB contains the following CREATE TABLE tree ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, grove_id INTEGER, type INTEGER NOT NULL,

jOOQ - how to use .whereNotExists() with conditional update?

本秂侑毒 提交于 2019-12-11 05:17:35
问题 I have a following jOOQ query, originally composed with the help of Lukas Eder in this question. create.insertInto(DATA,DATA.TICKER,DATA.OPEN,DATA.HIGH,DATA.LOW,DATA.CLOSE,DATA.DATE) .select( select( val(dailyData.getTicker()), val(dailyData.getOpen()), val(dailyData.getHigh()), val(dailyData.getLow()), val(dailyData.getClose()), val(dailyData.getDate()) ) .whereNotExists( selectOne() .from(DATA) .where(DATA.DATE.eq(dailyData.getDate())) ) ).execute(); This query works properly. In addition,

Jooq combination of two working queries failing with FROM clause error

淺唱寂寞╮ 提交于 2019-12-11 05:01:57
问题 I have two queries that are working individually but when I attempt to combine them I am getting an error saying: "ERROR: missing FROM-clause entry for Table "A". The purpose of the queries is to look at the combined results of two tables which have a JSONB column in the format ["tag1","tag2","tag3"] with column name TAGS. Individually both queries work but when I attempt to combine them I get the error. I must be missing something but I've tried several approaches to no avail. Any idea how

JOOQ: Get table and columns with string?

别来无恙 提交于 2019-12-11 04:38:06
问题 Hello I'm using JOOQ with Spring Boot and was wondering if there was a way to obtain a table and its columns with a string of their name? For example: I want to be able to get a table by doing something like: someObject.getTable("user") Then using the result of that get method I also want to obtain all of that table's columns and be able to compare the column names to other strings. In other words if there is a way to get a table, can I also get the table's column names from that same object?

How to initialise and create a ResultSet and Record in Jooq?

烂漫一生 提交于 2019-12-11 04:33:32
问题 I need to write some unit tests for that I have to mock the Result set and Record with some dummy data. I don't know how to initialize and instantiate them. Please help Thanks in advance. 回答1: jOOQ has a few built-in mock features, see the chapter JDBC mocking for unit testing of the manual, it might be what you are looking for. However, to simply create a jOOQ's Result or Record , you may use the DSLContext for that: // Create the record using the jOOQ generated classes and set a property

jOOQ: returning list with join,groupby and count in single object

我与影子孤独终老i 提交于 2019-12-11 04:26:15
问题 Core question: how do you properly fetch information from a query into objects? Idea I am creating functions in my DAO, which comes down to the following query: select A.*, count(*) from A left join B on B.aId = A.aId group by A.* Im looking for a way to create a jOOQ expression that just gives me a list (or something I can loop over) with objects A (pojo) and Integer. Concrete case In my code case: A = Volunteer and B = VolunteerMatch where I store several matches for each volunteer. B has

Find and sum difference between timestamps in seconds in PostgreSQL using JOOQ

时光怂恿深爱的人放手 提交于 2019-12-11 03:58:51
问题 This is a follow up question to another question of mine (Find difference between timestamps in seconds in PostgreSQL using JOOQ). I want to to sum the diff of TIMETRACKS.ENDTIME and TIMETRACKS.STARTTIME in seconds. It can happen that there will not be any TIMETRACKS in the database. In this case the database should return 0 instead. Thats how the TIMETRACKS table looks like: CREATE TABLE "TimeTracks" ( "id" uuid PRIMARY KEY, "startTime" timestamp NOT NULL, "endTime" timestamp, ); This is one

Using embedded database with Flyway and jOOQ in Maven for continuous integration

99封情书 提交于 2019-12-11 03:44:26
问题 So I'm really trying to do things 'right' with SQL that will break at compile time using flyway and jOOQ. To do this I need a database solution that can work on the continuous integration server with no access to any server-based database. Ultimately, I want to deploy this to Amazon so I need a solution that is mostly compatible with postgreSQL. HSQLDB's file protocol seems to fit that bill. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema

JOOQ fetch record from table and insert it into another table

和自甴很熟 提交于 2019-12-11 03:34:09
问题 I want to select all fields from one table, fetch into a record of another table, and insert the record into that table. However, I am getting an error saying that the values are null. Here is the relevant piece of code: // Fetch PersonDeactivatedRecord person = getContext().selectFrom(PERSON) .where(PERSON.ID.eq(id)) .fetchOneInto(PersonDeactivatedRecord.class); // Insert person.setDeactivatedOn(new Timestamp(System.currentTimeMillis())); getContext().insertInto(PERSON_DEACTIVATED) .set

Overriding jOOQ's exception handling for UpdatableRecords

大憨熊 提交于 2019-12-11 03:32:16
问题 I'm using jOOQ v2.6 as I'm using SQL Server 2008 R2 and there is a bug in jOOQ v3.1 which causes code generation to fail. (I'm aware this will be fixed in v3.2). From the manual: // Create a new record BookRecord book1 = create.newRecord(BOOK); // Insert the record: INSERT INTO BOOK (TITLE) VALUES ('1984'); book1.setTitle("1984"); book1.store(); If store() fails, a DataAccessException is thrown. In my case I would simply like the process to sleep until either the CRUD operation works, or I