View Javadoc
1   package ca.uhn.fhir.jpa.dao.data;
2   
3   import java.util.Collection;
4   
5   import org.springframework.data.domain.Page;
6   import org.springframework.data.domain.Pageable;
7   
8   /*
9    * #%L
10   * HAPI FHIR JPA Server
11   * %%
12   * Copyright (C) 2014 - 2018 University Health Network
13   * %%
14   * Licensed under the Apache License, Version 2.0 (the "License");
15   * you may not use this file except in compliance with the License.
16   * You may obtain a copy of the License at
17   * 
18   *      http://www.apache.org/licenses/LICENSE-2.0
19   * 
20   * Unless required by applicable law or agreed to in writing, software
21   * distributed under the License is distributed on an "AS IS" BASIS,
22   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23   * See the License for the specific language governing permissions and
24   * limitations under the License.
25   * #L%
26   */
27  
28  import org.springframework.data.jpa.repository.JpaRepository;
29  import org.springframework.data.jpa.repository.Modifying;
30  import org.springframework.data.jpa.repository.Query;
31  import org.springframework.data.repository.query.Param;
32  
33  import ca.uhn.fhir.jpa.entity.Search;
34  import ca.uhn.fhir.jpa.entity.SearchResult;
35  
36  public interface ISearchResultDao  extends JpaRepository<SearchResult, Long> {
37  	
38  	@Query(value="SELECT r FROM SearchResult r WHERE r.mySearch = :search")
39  	Collection<SearchResult> findWithSearchUuid(@Param("search") Search theSearch);
40  	
41  	@Query(value="SELECT r FROM SearchResult r WHERE r.mySearch = :search ORDER BY r.myOrder ASC")
42  	Page<SearchResult> findWithSearchUuid(@Param("search") Search theSearch, Pageable thePage);
43  
44  	@Modifying
45  	@Query(value="DELETE FROM SearchResult r WHERE r.mySearchPid = :search")
46  	void deleteForSearch(@Param("search") Long theSearchPid);
47  }