jooq

JOOQ Cast String to Enum with Converter inline

為{幸葍}努か 提交于 2019-12-13 17:19:20
问题 As asked here the follow up Question to this #58538732 As suggested by Lukas Eder I wrote an EnumConverter to convert the Integer to a DayOfWeek public class DOWConverter extends EnumConverter<Integer, DayOfWeek> { public DOWConverter() { super(Integer.class, DayOfWeek.class); } } The select now looks the following DataType<DayOfWeek> typeDOW = SQLDataType.INTEGER.asConvertedDataType(new DOWConverter() /*ERROR*/); Field<DayOfWeek> fieldDOW = DSL.field("{0}", typeDOW, lecture.DAY_OF_WEEK);

Getting results from table-valued Postgresql function with JOOQ

牧云@^-^@ 提交于 2019-12-13 07:41:28
问题 I have a Postgresql function that returns Table CREATE OR REPLACE FUNCTION test_func(IN param1 text, IN param2 integer) RETURNS TABLE(result1 text, result2 integer) AS $BODY$ BEGIN result1 := 'aa'; result2 :=1; return next; result1 := 'bb'; result2 :=2; return next; END $BODY$ LANGUAGE plpgsql Query in pg-admin returns correct result select * from test_func('aaa', 23); result1 | result2 "aa" | 1 "bb" | 2 JOOQ generates function as always ... public class TestFunc extends org.jooq.impl

How to convert Sql orderby clause with Case Statement into JOOQ?

安稳与你 提交于 2019-12-13 06:36:05
问题 I want to convert Sql orderby clause with Case using JOOQ .and BillAmount is of BigDecimal datatype. ORDER BY CASE WHEN (BillAmount <= 0) THEN BillAmount ELSE BillNumber END How to write the above line using JOOQ ? 回答1: Your best option is to directly translate your SQL clause to a corresponding jOOQ clause using the CASE expression (as documented in the manual) .orderBy(DSL.decode().when(BillAmount.le(0), BillAmount) .otherwise(BillNumber)) 来源: https://stackoverflow.com/questions/19654784

When is a Connection closed when calling JooQ DSLContext's .close(), if at all?

自作多情 提交于 2019-12-13 02:00:19
问题 Here is the code of a class which I am writing which uses JooQ 3.7.0 (the irrelevant parts have been stripped); note the uses of the AutoCloseable feature of DSLContext : public final class JooqPerMethodMetricWriter implements PerMethodMetricWriter { private static final Logger LOGGER = LoggerFactory.getLogger(JooqPerMethodMetricWriter.class); // [snip] private final DSLContext jooq; public JooqPerMethodMetricWriter(final Connection connection, final Instant instant) throws IOException { //

jOOQ - support for UPDATE … SET … query with arbitrary degree

穿精又带淫゛_ 提交于 2019-12-13 01:54:25
问题 I have two functions: one returns a list of fields, the other returns a select query (which selects the corresponding values of the fields). private List<Field<?>> fields() { .... } private Select<?> select() { ... } Note that the degree is determined at runtime, it depends on the user input. Hence List<Field<?>> and Select<?> . It is possible to insert into a table: context.insertInto(table, fields()).select(select())) It is not possible to update a table: context.update(table).set(DSL.row

How to convert list into UpdatableRecord?

情到浓时终转凉″ 提交于 2019-12-13 00:14:09
问题 I have issue related batchDelete in jooq. I have a list folderProcessChecklistRecordList in my code given below .But the issue is that convert list into UpdatableRecord .Because of batchDelete argument required UpdatableRecord . Error: The method batchDelete(UpdatableRecord...) in the type Transaction is not applicable for the arguments (List) Code here: public void deleteFolderProcessChecklist(String folderType, List<FolderProcessChecklistRecord> folderProcessChecklistRecordList) throws

Jooq, Spring, And BoneCP connection closed twice error

拟墨画扇 提交于 2019-12-12 20:57:14
问题 I am using Spring 4.0.0, along with jOOQ 3.2.0 and BoneCP 0.8.0 for a web application. I have the PersistenceContext configured the same as this guide (please skim read it's a little too much code to paste here) http://www.petrikainulainen.net/programming/jooq/using-jooq-with-spring-configuration/ but with a smaller number of max connections and closeConnectionWatch = true for error checking. From what I can deduce, this guide is a non-XML version of the jOOQ website's own guide seen here

How to call a postgresql function from the JOOQ models in a select statement?

限于喜欢 提交于 2019-12-12 18:12:51
问题 I have a function in my postgresql database which takes in JSONB paramaters. I created a custom binding and forced type to map the JSONB type of postgres to Gson's JsonElement (I've copied the converter and my gradle build config below). I'm calling the function as part of a select statement using JOOQ's models (which expects parameters of type Object ) and get an error Exception in thread "main" org.jooq.exception.DataAccessException: SQL [select "tact_shard_0"."records"."id", "public".

JOOQ class generation and gradle

三世轮回 提交于 2019-12-12 16:17:33
问题 My question is what is the best way to set up my build using gradle and jooq with the following constraints: I have: A very basic gradle build file, but one that can use eclipse, jooq, postgres and HSQL Some 'core' java classes, including a couple of Enums, in an eclipse project managed by gradle Several database schemata, each in its own file (schema1.sql, schema2.sql, etc), in that same project The most excellent JOOQ library, and the quite cool SQLFile utility from HSQLDB A combination of

How can we profile JOOQ statements for speed

眉间皱痕 提交于 2019-12-12 15:45:15
问题 I already have implemented JOOQ with Union Platform as a java based game server and using Union Platform's Orbiter Micro (Union JS Client) for running it on a browser. However, event with small 30-40 active players in the game, the Union Platform is lagging in terms of speed. For each game instance (i.e each room) , i have configured one factory connection which executes all the queries. What it does is , For each player's turn, player can put in an integer and after a series (4 queries) of