Interface ProdutoRepository

  • All Superinterfaces:
    org.springframework.data.repository.CrudRepository<Produto,​Integer>, org.springframework.data.jpa.repository.JpaRepository<Produto,​Integer>, org.springframework.data.repository.PagingAndSortingRepository<Produto,​Integer>, org.springframework.data.repository.query.QueryByExampleExecutor<Produto>, org.springframework.data.repository.Repository<Produto,​Integer>

    @Repository
    @Transactional(readOnly=true)
    public interface ProdutoRepository
    extends org.springframework.data.jpa.repository.JpaRepository<Produto,​Integer>
    Interface de repositório para Produtos
    Author:
    José Henrique
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      org.springframework.data.domain.Page<Produto> findDistinctByNomeContainingAndCategoriasIn​(String nome, List<Categoria> categorias, org.springframework.data.domain.Pageable pageable)
      Procura por Produtos com suas Categorias
      • Methods inherited from interface org.springframework.data.repository.CrudRepository

        count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save
      • Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

        deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getById, getOne, saveAll, saveAllAndFlush, saveAndFlush
      • Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

        findAll
      • Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

        count, exists, findAll, findOne
    • Method Detail

      • findDistinctByNomeContainingAndCategoriasIn

        @Query("SELECT DISTINCT produto FROM Produto produto INNER JOIN produto.categoriasList categorias WHERE produto.nome LIKE %:nome% AND categorias IN :categorias")
        org.springframework.data.domain.Page<Produto> findDistinctByNomeContainingAndCategoriasIn​(@Param("nome")
                                                                                                  String nome,
                                                                                                  @Param("categorias")
                                                                                                  List<Categoria> categorias,
                                                                                                  org.springframework.data.domain.Pageable pageable)
        Procura por Produtos com suas Categorias
        Parameters:
        nome - Nome do Produto
        categorias - Lista das possíves Categorias do Produto
        pageable - Um Page
        Returns:
        Um Page com dos Produtos