1

I have searched Xodus and Xodus-DNQ and I am not able to find an idiomatic way to update an entity that is already inside a Xodus database, using Xodus-DNQ. Would I have to delete that entity and created it again afterwards, or is there a better way to do this?

Thank you

1 Answers1

2

Bruno, you can just update the fields of the entity in a transaction. That's it.

Please, check the sample right in the README.md. In this block field posts of the blog is actually updated.

   xodusStore.transactional {
        // Create new post
        val post = XdPost.new {
            this.publishedAt = DateTime.now()
            this.text = args.firstOrNull() ?: "Empty post"
        }

        // Add new post to blog
        blog.posts.add(post)
    }
Maxim Mazin
  • 3,816
  • 1
  • 21
  • 15