2

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 support this so I added a custom binding which was supposed to solve the problem but even though the binding is loaded it never applies on the specific model and the generator just skips this model.

My stack (in the demo) is: JOOQ Hibernate Jackson.

The demo project provides two models, one valid and one with JsonNode to show that the generator is actually running and scanning the models but skips the model containing JsonNode field.

I have already tried a variety of names in forcedType expression field: .simplename. , .SIMPLENAME., .impl., .IMPL., .json., .JSON., .jsonb., .JSONB.,

tried to set the setting the sql in binding to ::json , ::jsonb, ::_jsonb

tried to set the register type to Types.VARCHAR, Types.OTHER, Types.JAVA_OBJECT

The following repo https://github.com/mmichailidis/JooqDemo contains a project that reproduce the problem

The expected output is for both models to be generated in the jooq generated folder but only the one without the JsonNode is getting generated.

Michael Michailidis
  • 1,002
  • 1
  • 8
  • 21
  • Thanks for your question. For future users, it will be useful if you could post your entire pom.xml directly here in this question. Your repository might become a dead link in only a few months and this question will not be useful to other Stack Overflow visitors – Lukas Eder Jun 06 '19 at 13:38

1 Answers1

0

You're using the JPADatabase: https://www.jooq.org/doc/latest/manual/code-generation/codegen-jpa

The way it is currently implemented, you cannot process your entities with the JPADatabase in the same Maven phases as the entities themselves are compiled. They are not yet available on the classpath of the JPADatabase. You must extract your entities into a separate project and generate jOOQ code in a second step.

The reason why you might see one of the models could be because you had installed them before in your local repository through some other way.

Lukas Eder
  • 211,314
  • 129
  • 689
  • 1,509
  • Thank you for your answer. The original project was a multi-module one that followed the instructions of the article that you linked. Now I've updated the demo project to follow the original in terms of the module structure. Unfortunately, the problem persists. Nothing was installed in the local repository and all tests where run with `mvn clean package`. – Michael Michailidis Jun 06 '19 at 14:17