https://kotlinlang.org logo
#micronaut
Title
# micronaut
a

Artyom Gornostayev

03/28/2024, 11:26 AM
Hello guys. Did anybody have a problem with
@GeneratedValue
? I'm using Micronaut Data with R2DBC. I have a class:
Copy code
data class Product(
    @Id
    @GeneratedValue
    var id: Long? = null,
    val publicId: UUID,
    val code: String,
    ...
)
When I'm trying to save a new record (
id = null
) with
repository.save(product)
the exception has thrown...
Copy code
null value in column "id" of relation "products" violates not-null constraint
I'm not sure what is wrong...
2 Views