Package dev.dokimos.server.repository
Interface DatasetRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Dataset,,UUID> org.springframework.data.jpa.repository.JpaRepository<Dataset,,UUID> org.springframework.data.repository.ListCrudRepository<Dataset,,UUID> org.springframework.data.repository.ListPagingAndSortingRepository<Dataset,,UUID> org.springframework.data.repository.PagingAndSortingRepository<Dataset,,UUID> org.springframework.data.repository.query.QueryByExampleExecutor<Dataset>,org.springframework.data.repository.Repository<Dataset,UUID>
-
Method Summary
Modifier and TypeMethodDescriptionbooleanexistsByName(String name) Loads a dataset while acquiring a pessimistic write lock on its row.findByName(String name) findByNameForUpdate(String name) Locking lookup by name; equivalent tofindByIdForUpdate(java.util.UUID)but resolved in a single round trip when the caller only has the dataset name.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByName
-
existsByName
-
findByIdForUpdate
@Lock(PESSIMISTIC_WRITE) @Query("select d from Dataset d where d.id = :id") Optional<Dataset> findByIdForUpdate(@Param("id") UUID id) Loads a dataset while acquiring a pessimistic write lock on its row. Used to serialize new version creation so thenext = max(version) + 1computation cannot race two callers onto the same version number. The(dataset_id, version)unique constraint is the backstop if the lock is bypassed. -
findByNameForUpdate
@Lock(PESSIMISTIC_WRITE) @Query("select d from Dataset d where d.name = :name") Optional<Dataset> findByNameForUpdate(@Param("name") String name) Locking lookup by name; equivalent tofindByIdForUpdate(java.util.UUID)but resolved in a single round trip when the caller only has the dataset name. Used by version creation so the pessimistic write lock is acquired atomically with the lookup.
-