Is there a DAO equivalent to the DSL insert ignore? Right now I have a helper function:
Copy code
fun <ID : Comparable<ID>, T : Entity<ID>> EntityClass<ID, T>.newOrUpdate(id: ID, update: T.() -> Unit): T {
val existing = findById(id)
return if (existing != null) existing.apply(update)
else new(id, update)
}
But there is an unnecessary query if the entity isn't cached. This method aims to just end up with a new entity with the supplied id, regardless of whether it exists already