bgiles
bgiles

Reputation: 1230

record content lost with jooq 18 + spring boot 3.2 + jpa annotations [updated]

I'm working on a small tutorial project that will have both jooq and various spring database implementations. The idea is to demonstrate a core module with nearly everything plus minimal, easily swapped implementations of specific functionality like persistence.

I started with jooq (+ postgresql test container). I'm using codegen running against a test container + flyway. (Still testcontainers-jooq-codegen-maven-plugin 0.0.3 though - I'll bump it but have been putting it off since it's working and I know I'll need to make a few changes with the new plugin.)

The next step is adding JPA annotations - but nothing else. I rerun my tests and immediately see constraint violations?!?!. After disabling the constraints and adding a few log statements I can see:

If I remove the JPA annotations the tests pass again.

There's no change in behavior if I add or remove

@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)

I did a quick search and it looks like this should work... but all of the comments were many years old. So basically meaningless at this point.


I'll push the code to a public github repo soon but wanted to post this question first in case it's a trivial oversight that's quickly recognized and fixed. I'll update this post when I do.


Details:


UPDATE

I've bumped everything but java 18 to the latest versions, and refactored the code generator to use the latest org.jooq plugin instead of the prior testcontainer version.

The problem is still present.

coyotesong/spring-boot-with-testcontainers-examples, in the spring-boot-3x-and-databases directory.

Pre-updates I saw the problem with nothing more than @Table and when every field is annotated. This morning I've only tested it with @Table. It shouldn't matter though since I'm using jOOQ code generation - not JPA.

Upvotes: 0

Views: 52

Answers (0)

Related Questions