View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements. See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache license, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License. You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the license for the specific language governing permissions and
15   * limitations under the license.
16   */
17  package org.apache.logging.log4j.catalog.jpa.dao;
18  
19  import org.springframework.data.jpa.domain.Specification;
20  import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
21  import org.springframework.data.jpa.repository.Modifying;
22  import org.springframework.data.repository.NoRepositoryBean;
23  import org.springframework.data.repository.Repository;
24  
25  import java.io.Serializable;
26  import java.util.List;
27  import java.util.Optional;
28  
29  @NoRepositoryBean
30  public interface BaseRepository <T, ID extends Serializable> extends Repository<T, ID>, JpaSpecificationExecutor<T> {
31      Optional<T> findOne(ID id);
32      List<T> findAll();
33      List<T> findAll(Specification<T> spec);
34      @Modifying
35      T save(T persisted);
36      @Modifying
37      void delete(T deleted);
38      @Modifying
39      void deleteById(ID id);
40  }