Skip to content

Allow entities in quarkus-mongodb-panache-kotlin to use data class with val #45500

@loriepisicchio

Description

@loriepisicchio

Description

I have a project using mongodb-panache-kotlin extension to manipulate data in a MongoDB. We follow the repository pattern as presented in the documentation, using Kotlin data classes.

The documentation found here states that the Kotlin data classes representing Mongo Entities can use either val or var for the properties.

But I noticed that when using val, the Mongo driver returns an object with null values for every properties.

I have a project to reproduce the issue here : https://github.com/loriepisicchio/mongo-panache-kotlin

You can run UserMedicalStudyPanacheRepositoryTest as integration test. You will see the tests failing because the object properties are null.
If you change vals into var in UserMedicalStudyEntity, the tests will pass.

Let me know if you need more information.

Implementation ideas

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions