SimpleRepository

Simple variant of CRUDRepository

This is meant to be implemented from a @Repository interface.

Parameters

I

Id type of the data

E

Entity type of the data which is a SimpleEntity

Inherited functions

Link copied to clipboard
abstract fun findAllByDeletedAtIsNull(pageable: Pageable): Page<E>

Finds all entities for given pagination and deletion flag

Link copied to clipboard
abstract fun findByIdAndDeletedAtIsNull(id: I): E?

Finds an entity with given id and deletion flag

Link copied to clipboard
abstract fun flush()

Flushes the changes to the database

Link copied to clipboard
@Modifying(clearAutomatically = true, flushAutomatically = true)
abstract fun save(entity: E): E

Saves given entity, used when creating a new entity

Link copied to clipboard
@Modifying(clearAutomatically = true, flushAutomatically = true)
@Query(value = "UPDATE #{#entityName} e SET e = :entity, e.version = :#{#entity.version} + 1 WHERE e.id = :#{#entity.id} AND e.version = :#{#entity.version}")
abstract fun update(entity: E): Int

Updates given entity if it is at set version using optimistic locking