jooq

Using HSQLDB with the SQL Maven Plugin and jOOQ

帅比萌擦擦* 提交于 2019-12-10 11:58:28
问题 This is a similar question like Using embedded database with Flyway and jOOQ in Maven for continuous integration, although not exactly the same as we're using the sql-maven-plugin , not Flyway. The following Maven plugin configuration fails: sql-maven-plugin <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>sql-maven-plugin</artifactId> <version>1.5</version> <executions> <execution> <id>create-database</id> <phase>generate-sources</phase> <goals> <goal>execute</goal> </goals>

How to Handle Date in Jooq?

独自空忆成欢 提交于 2019-12-10 09:32:10
问题 When we are using plain JDBC connection we are using below code to format date or convert date if(argDB.equals("Oracle")){ sb.append(" AND TO_CHAR(PaymentDate, 'YYYY-MM-DD') <= TO_CHAR(SYSDATE,'YYYY-MM-DD')"); } else { sb.append(" AND CONVERT(VARCHAR(8), PaymentDate, 112) <= CONVERT(varchar(8), dbo.getdate(), 112)"); } Now we are using JOOQ Do you think we have to convert date like we did previously or JOOQ can handle this type of problem internally.? As i checked right now JOOQ not supported

How to start transaction and rollback with JOOQ?

若如初见. 提交于 2019-12-10 02:44:54
问题 Yes! I have read the docs about jOOQ will never commit or rollback on the Connection (Except for CSV-imports, if explicitly configured in the Import API) jOOQ will never start any transactions. ... but when I need some transaction management, what is the best practice to do this? Have I said that I'm a big fan of a way of JOOQ! 回答1: This question was asked at a time when jOOQ did not yet implement a transaction API. As of jOOQ 3.4 onwards, such an API is available and documented here: https:/

How to use a custom strategy with the jOOQ code-generator and Maven?

两盒软妹~` 提交于 2019-12-10 01:56:54
问题 With jOOQ, I may want to combine using the jOOQ code generator with Maven and a custom generator strategy. It looks as though this can be done as such (leaving out irrelevant parts): <plugin> <groupId>org.jooq</groupId> <artifactId>jooq-codegen-maven</artifactId> <version>2.2.2</version> <!-- The plugin should hook into the generate goal --> <executions> <execution> <goals> <goal>generate</goal> </goals> </execution> </executions> <configuration> <generator> <name>org.jooq.util

How can I simply add a link to a Spring Data REST Entity

那年仲夏 提交于 2019-12-09 15:59:00
问题 I have my Entities with Spring Data JPA, but to generate stats about them, I use jOOQ in a Spring @Repository . Since my methods return either a List of entities, or a Double , how can I expose them as links? Let's say I have a User entity, I want to get the following JSON: { "_embedded" : { "users" : [ ] }, "_links" : { "self" : { "href" : "http://localhost:8080/api/users" }, "stats" : { "href" : "http://localhost:8080/api/users/stats" } "profile" : { "href" : "http://localhost:8080/api

jOOQ Timestamp being stored with local Timezone offset

…衆ロ難τιáo~ 提交于 2019-12-08 17:06:55
PostgreSQL 9.3 / postgresql-9.3-1100-jdbc41.jar I have a table with a column of type timezone without time zone , this generates my Object with the applicable java.util.Timestamp property. What I'm seeing, during insert, is jOOQs binding process converting a java.util.Timestamp into a date with local timezone offset. eg for a unix timestamp 1421109419 (13 Jan 2015 00:36:59 GMT) the property is set with new Timestamp(1421109419 * 1000) . from the jOOQ logger I see: 2015-01-13 14:14:31,482 DEBUG [http-bio-8002-exec-4] org.jooq.tools.LoggerListener#debug:255 - -> with bind values : insert into

jOOQ insert query with returning generated keys

南楼画角 提交于 2019-12-08 16:19:50
问题 I installed jOOQ into eclipse, generated classes for my mySQL, but I still have problems to write also some basic queries. I tried to compose insert query with returning of generated keys, but compiler throws error Table: tblCategory Columns: category_id, parent_id, name, rem, uipos Result<TblcategoryRecord> result= create.insertInto(Tblcategory.TBLCATEGORY, Tblcategory.PARENT_ID, Tblcategory.NAME, Tblcategory.REM, Tblcategory.UIPOS) .values(node.getParentid()) .values(node.getName()) .values

ANY operator with jOOQ

雨燕双飞 提交于 2019-12-08 06:35:46
问题 I am having troubles understanding the following. I have a field and some values: Field<T> field = ...; List<T> values = ...; Now, I want to express the filter field = ANY({... the values ....}) in a WHERE clause. PostgreSQL supports this ANY(array of values) operator. I got this idea from https://blog.jooq.org/2017/03/30/sql-in-predicate-with-in-list-or-with-array-which-is-faster/. I tried the following to create a condition: field.equal(PostgresDSL.any(PostgresDSL.array(values))); The above

jOOQ Timestamp being stored with local Timezone offset

泪湿孤枕 提交于 2019-12-08 04:57:19
问题 PostgreSQL 9.3 / postgresql-9.3-1100-jdbc41.jar I have a table with a column of type timezone without time zone , this generates my Object with the applicable java.util.Timestamp property. What I'm seeing, during insert, is jOOQs binding process converting a java.util.Timestamp into a date with local timezone offset. eg for a unix timestamp 1421109419 (13 Jan 2015 00:36:59 GMT) the property is set with new Timestamp(1421109419 * 1000) . from the jOOQ logger I see: 2015-01-13 14:14:31,482

jOOQ - multi-field for insertion

ぃ、小莉子 提交于 2019-12-08 01:40:58
问题 I would like to express the following INSERT statement: context.insertInto(TABLE A) .set(<FIELD A, FIELD B>, context.select(FIELD A, FIELD B).from(B).where(...)) .set(... other field of table A ...) .set(... other field of table A ...) .set(... other field of table A ...) .returning() .fetch() The sub-select returns one row with two columns ( FIELD A and FIELD B ) which need to be inserted into the target TABLE A . The reason for this is that <FIELD A, FIELD B> is the primary key of TABLE B .