micronaut-data icon indicating copy to clipboard operation
micronaut-data copied to clipboard

@DateCreated: Breaking change in micronaut-parent:4.3.2

Open roar-skinderviken opened this issue 1 year ago • 1 comments
trafficstars

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

roar-skinderviken avatar Feb 25 '24 10:02 roar-skinderviken

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.

jamesdh avatar Feb 28 '24 17:02 jamesdh

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

radovanradic avatar Feb 28 '24 20:02 radovanradic

@roar-skinderviken I have verified this is solved with 4.3.5

sdelamo avatar Mar 14 '24 10:03 sdelamo

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.

roar-skinderviken avatar Mar 16 '24 17:03 roar-skinderviken

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?

roar-skinderviken avatar Mar 17 '24 11:03 roar-skinderviken

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.

sdelamo avatar Mar 18 '24 17:03 sdelamo

I have reverted the change to micronaut-sql https://github.com/micronaut-projects/micronaut-sql/pull/1300

timyates avatar Mar 22 '24 15:03 timyates

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!

timyates avatar Mar 25 '24 08:03 timyates