micronaut-data
micronaut-data copied to clipboard
@DateCreated: Breaking change in micronaut-parent:4.3.2
Expected Behavior
When saving an entity with a field like this
@DateCreated
@Column(nullable = false)
var created: ZonedDateTime? = null
I expect field to be populated during persistence of instance like it did with MN:4.3.1.
Actual Behaviour
With MN:4.3.2 in the example application, I get this test-error:
DemoRepositoryTest » PropertyValue not-null property references a null or transient value : no.javatec.demo.repository.DemoEntity.created
Steps To Reproduce
In the example-app, bump micronaut-parent from 4.3.1 to 4.3.2 or 4.3.3 and run
./mvnw clean verify
and observe that tests in DemoRepositoryTest are now failing.
Environment Information
Ubuntu 22.04 JDK 17 Kotlin 1.9.22
Example Application
https://github.com/roar-skinderviken/postgres-testcontainer-demo
Version
4.3.3
I previously reported something similar in #2342. I was unaware that it was ever working correctly. I'm currently using 4.2.4 and still experience this.
This one is indeed different issue and is caused by micronaut-sql 5.5.1 release. The workaround for this is either adding implementation("io.micronaut.validation:micronaut-validation") dependency or adding this JPA property jpa.default.properties.hibernate.check_nullability=false but probably should fix root cause in micronaut-sql
@roar-skinderviken I have verified this is solved with 4.3.5
Hi @sdelamo
Build for this PR created by Dependabot for bumping to MN:4.3.5 fails with the same error: https://github.com/roar-skinderviken/postgres-testcontainer-demo/pull/45
But I can see that 4.3.6 is mentioned above, so maybe wait for that one.
Hi again @sdelamo
Tests are not passing with MN:4.3.6. https://github.com/roar-skinderviken/postgres-testcontainer-demo/pull/50
Could you please describe how you made tests in the example repo passing with MN:4.3.5?
sorry, I had in your sample project both version updated to 4.3.6 and adding the dependency:
<dependency>
<groupId>io.micronaut.validation</groupId>
<artifactId>micronaut-validation</artifactId>
</dependency>
and that make it work.
I have reverted the change to micronaut-sql https://github.com/micronaut-projects/micronaut-sql/pull/1300
So micronaut-sql 5.5.2 reverts this change, and it will be in the next 4.3.x release of Micronaut (4.3.8)
Thanks @roar-skinderviken for the report!