Skip to content

Instantly share code, notes, and snippets.

@theboreddev
Created October 10, 2022 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theboreddev/ee9264c6c2879ab6889e632805119776 to your computer and use it in GitHub Desktop.
Save theboreddev/ee9264c6c2879ab6889e632805119776 to your computer and use it in GitHub Desktop.
With transaction support
fun create(user: User): User {
return withinTransaction {
val savedUser = userRepository.save(user)
eventsEngine.send(UserCreated(UUID.randomUUID().toString(), user))
User.create(savedUser)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment