Class CrudRepositoryService<T,ID,R extends org.springframework.data.repository.CrudRepository<T,ID> & org.springframework.data.jpa.repository.JpaSpecificationExecutor<T>>

java.lang.Object
com.vaadin.hilla.crud.ListRepositoryService<T,ID,R>
com.vaadin.hilla.crud.CrudRepositoryService<T,ID,R>
All Implemented Interfaces:
CountService, CrudService<T,ID>, FormService<T,ID>, GetService<T,ID>, ListService<T>

public class CrudRepositoryService<T,ID,R extends org.springframework.data.repository.CrudRepository<T,ID> & org.springframework.data.jpa.repository.JpaSpecificationExecutor<T>> extends ListRepositoryService<T,ID,R> implements CrudService<T,ID>
A browser-callable service that delegates crud operations to a JPA repository.
  • Constructor Details

    • CrudRepositoryService

      public CrudRepositoryService()
    • CrudRepositoryService

      public CrudRepositoryService(R repository)
      Creates the service using the given repository.
      Parameters:
      repository - the JPA repository
  • Method Details

    • save

      public @Nullable T save(T value)
      Description copied from interface: FormService
      Saves the given object and returns the (potentially) updated object.

      If you store the object in a SQL database, the returned object might have a new id or updated consistency version.

      Specified by:
      save in interface FormService<T,ID>
      Parameters:
      value - the object to save
      Returns:
      the fresh object or null if no object was found to update
    • saveAll

      public List<T> saveAll(Iterable<T> values)
      Saves the given objects and returns the (potentially) updated objects.

      The returned objects might have new ids or updated consistency versions.

      Parameters:
      values - the objects to save
      Returns:
      the fresh objects
    • delete

      public void delete(ID id)
      Description copied from interface: FormService
      Deletes the object with the given id.
      Specified by:
      delete in interface FormService<T,ID>
      Parameters:
      id - the id of the object to delete
    • deleteAll

      public void deleteAll(Iterable<ID> ids)
      Deletes the objects with the given ids.
      Parameters:
      ids - the ids of the objects to delete