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:
- the DAOImpl.insert() calls see the values
- the DAOImpl.fetchAll() etc calls see records but all fields except the autopopulated key are null
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:
- java 18
- spring boot 3.2.0
- jooq 3.18.7 (community)
- test containers 1.19.1