Giuliopime
11/10/2023, 11:38 AMtransaction
block even when using DAOs correct?
• when working with ktor, I saw that the sample uses the newSuspendedTransaction
function. Is this necessary because ktor uses coroutines, or is it optional?
• If I declare the database connection in a class, can I then use the transaction
block without passing the db as a parameter, is it handled by exposed already?UUIDTable
instead?
Example
private fun UserEntity.fromDto(userDto: UserDto) {
email = userDto.email
passwordHash = userDto.passwordHash
emailVerified = userDto.emailVerified
createdAt = userDto.creationTimestamp
creationSource = userDto.creationSource
}
UserEntity.new(userDto.id.id) {
fromDto(userDto)
}
notForUpdate
?Aleksei Tirman [JB]
11/15/2023, 4:25 PMjava.lang.IllegalStateException: No transaction in context.
will be thrown.
• It's optional but better for the user experience.
• You can. In that case the last connection will be used.