@krivopustov I just experienced the problem again after migrating a production project from Jmix 1.4.4 to 1.5.5.
Indeed the persistence.xml was not generated properly and the entities enhancing was not performed even after running gradlew clean compileJava.
Since I am developing non-Jmix applications as well using gradle builds the installed gradle version is 8.7 in the meantime and I updated the wrapped gradle version of Jmix 1.x projects to 7.6.4 (all).
In user specific ~/.gradle/gradle.properties, I enabled caching:
...
org.gradle.caching=true
org.gradle.console=rich
...
After disabling the caching, stopping all gradle daemon processes and performing a clean rebuild, the persistence file was rebuilt.
Maybe entities enhancing clashes with build caching?