Interface ClipRepository
-
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Clip,java.lang.Long>
,org.springframework.data.jpa.repository.JpaRepository<Clip,java.lang.Long>
,org.springframework.data.repository.PagingAndSortingRepository<Clip,java.lang.Long>
,org.springframework.data.repository.query.QueryByExampleExecutor<Clip>
,org.springframework.data.repository.Repository<Clip,java.lang.Long>
public interface ClipRepository extends org.springframework.data.jpa.repository.JpaRepository<Clip,java.lang.Long>
ClipRepository
holds data forClip
. Aside from the CRUD methods provided by the extension of JpaRepository,getAllByLimitAndOffset
,getAllByUserAndLimitAndOffset
, andgetAllByUserIsInOrderByDateTimePostedDesc
provide for certain queries of the database.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Robert Dominguez, Roderick Frechette, Laura Steiner
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<Clip>
getAllByLimitAndOffset(int limit, int offset)
Gets all clips, limited by parameters, for use in Discovery mode.java.util.List<Clip>
getAllByUserAndLimitAndOffset(long userId, int limit, int offset)
Gets all clips for a particular user, limited by parameters.java.util.List<Clip>
getAllByUserIsInOrderByDateTimePostedDesc(java.util.Collection<User> users, int limit, int offset)
Gets all clips for users in a collection, limited by parameters.-
Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteById, existsById, findById, save
-
Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getOne, saveAll, saveAndFlush
-
-
-
-
Method Detail
-
getAllByLimitAndOffset
@Query(value="SELECT * FROM Clip ORDER BY date_time_posted DESC OFFSET :offset ROWS FETCH NEXT :limit ROWS ONLY", nativeQuery=true) java.util.List<Clip> getAllByLimitAndOffset(int limit, int offset)
Gets all clips, limited by parameters, for use in Discovery mode.- Parameters:
limit
- intoffset
- int- Returns:
- List<Clip>
-
getAllByUserAndLimitAndOffset
@Query(value="SELECT * FROM Clip WHERE user_id = :userId ORDER BY date_time_posted DESC OFFSET :offset ROWS FETCH NEXT :limit ROWS ONLY", nativeQuery=true) java.util.List<Clip> getAllByUserAndLimitAndOffset(long userId, int limit, int offset)
Gets all clips for a particular user, limited by parameters.- Parameters:
userId
- longlimit
- intoffset
- int- Returns:
- List<Clip>
-
getAllByUserIsInOrderByDateTimePostedDesc
@Query(value="SELECT * FROM Clip WHERE user_id IN :users ORDER BY date_time_posted DESC OFFSET :offset ROWS FETCH NEXT :limit ROWS ONLY", nativeQuery=true) java.util.List<Clip> getAllByUserIsInOrderByDateTimePostedDesc(java.util.Collection<User> users, int limit, int offset)
Gets all clips for users in a collection, limited by parameters.- Parameters:
users
- Collection<User>limit
- intoffset
- int- Returns:
- List<Clip>
-
-