Class SimpleSpannerRepository<T,I>

java.lang.Object
com.google.cloud.spring.data.spanner.repository.support.SimpleSpannerRepository<T,I>
Type Parameters:
T - the entity type of the repository
I - the id type of the entity
All Implemented Interfaces:
SpannerRepository<T,I>, org.springframework.data.repository.CrudRepository<T,I>, org.springframework.data.repository.PagingAndSortingRepository<T,I>, org.springframework.data.repository.Repository<T,I>

public class SimpleSpannerRepository<T,I> extends Object implements SpannerRepository<T,I>
The default implementation of a SpannerRepository.
Since:
1.1
  • Constructor Details

    • SimpleSpannerRepository

      public SimpleSpannerRepository(SpannerTemplate spannerTemplate, Class<T> entityType)
  • Method Details

    • getSpannerTemplate

      public SpannerOperations getSpannerTemplate()
      Description copied from interface: SpannerRepository
      Gets a SpannerOperations, which allows more-direct access to Google Cloud Spanner functions.
      Specified by:
      getSpannerTemplate in interface SpannerRepository<T,I>
      Returns:
      the operations object providing Cloud Spanner functions.
    • performReadOnlyTransaction

      public <A> A performReadOnlyTransaction(Function<SpannerRepository<T,I>,A> operations)
      Description copied from interface: SpannerRepository
      Performs multiple read-only operations in a single transaction.
      Specified by:
      performReadOnlyTransaction in interface SpannerRepository<T,I>
      Type Parameters:
      A - the final return type of the operations.
      Parameters:
      operations - the function representing the operations to perform using a SpannerRepository based on a single transaction.
      Returns:
      the final result of the transaction.
    • performReadWriteTransaction

      public <A> A performReadWriteTransaction(Function<SpannerRepository<T,I>,A> operations)
      Description copied from interface: SpannerRepository
      Performs multiple read and write operations in a single transaction.
      Specified by:
      performReadWriteTransaction in interface SpannerRepository<T,I>
      Type Parameters:
      A - the final return type of the operations.
      Parameters:
      operations - the function representing the operations to perform using a SpannerRepository based on a single transaction.
      Returns:
      the final result of the transaction.
    • save

      public <S extends T> S save(S entity)
      Specified by:
      save in interface org.springframework.data.repository.CrudRepository<T,I>
    • saveAll

      public <S extends T> Iterable<S> saveAll(Iterable<S> entities)
      Specified by:
      saveAll in interface org.springframework.data.repository.CrudRepository<T,I>
    • findById

      public Optional<T> findById(I id)
      Specified by:
      findById in interface org.springframework.data.repository.CrudRepository<T,I>
    • existsById

      public boolean existsById(I id)
      Specified by:
      existsById in interface org.springframework.data.repository.CrudRepository<T,I>
    • findAll

      public Iterable<T> findAll()
      Specified by:
      findAll in interface org.springframework.data.repository.CrudRepository<T,I>
    • findAllById

      public Iterable<T> findAllById(Iterable<I> ids)
      Specified by:
      findAllById in interface org.springframework.data.repository.CrudRepository<T,I>
    • count

      public long count()
      Specified by:
      count in interface org.springframework.data.repository.CrudRepository<T,I>
    • deleteById

      public void deleteById(Object id)
      Specified by:
      deleteById in interface org.springframework.data.repository.CrudRepository<T,I>
    • delete

      public void delete(Object entity)
      Specified by:
      delete in interface org.springframework.data.repository.CrudRepository<T,I>
    • deleteAll

      public void deleteAll(Iterable<? extends T> entities)
      Specified by:
      deleteAll in interface org.springframework.data.repository.CrudRepository<T,I>
    • deleteAll

      public void deleteAll()
      Specified by:
      deleteAll in interface org.springframework.data.repository.CrudRepository<T,I>
    • findAll

      public Iterable<T> findAll(org.springframework.data.domain.Sort sort)
      Specified by:
      findAll in interface org.springframework.data.repository.PagingAndSortingRepository<T,I>
    • findAll

      public org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable)
      Specified by:
      findAll in interface org.springframework.data.repository.PagingAndSortingRepository<T,I>
    • deleteAllById

      public void deleteAllById(Iterable<? extends I> ids)
      Specified by:
      deleteAllById in interface org.springframework.data.repository.CrudRepository<T,I>