Is there a way to add methods to Repository interf...
# spring
Is there a way to add methods to Repository interfaces that are not intended as queries? e.g.
Copy code
interface Repository<E : MyEntity> : JpaRepository<E, String> {
    operator fun contains(id: String) = existsById(id)

    operator fun get(id: String) = findByIdOrNull(id)
I'm exploring the possibility of having route controllers talk directly to repos, but a service in the middle to transform dao and dto is probably still too useful to warrant that
I just stick an extension function on my models called
in the web/api layer.
yeah, i usually do something like this:
Copy code
class User(
    @Email var email: String, 
    var password: String? = null,
    var createdOn: LocalDateTime = now()) : DAO() {
    val dto by lazy { DTO() }

    inner class DTO {
        val email get() =
        val createdOn get() = this@User.createdOn

        override fun toString() = Json.stringify(this)
the lazy delegation isn't really necessary. could just do
this is another example of why i'd love to have something like
inner object
in kotlin or the like, so I don't have to define an entire class per property of this sort. feels weird.
in java I just use default methods