Interface UserDeviceRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<UserDevice,,Integer> org.springframework.data.jpa.repository.JpaRepository<UserDevice,,Integer> org.springframework.data.repository.PagingAndSortingRepository<UserDevice,,Integer> org.springframework.data.repository.query.QueryByExampleExecutor<UserDevice>,org.springframework.data.repository.Repository<UserDevice,Integer>
@Repository
public interface UserDeviceRepository
extends org.springframework.data.jpa.repository.JpaRepository<UserDevice,Integer>
Repository for queries for user devices.
-
Method Summary
Modifier and TypeMethodDescriptionfindByUserIdAndDeviceId(String userId, String deviceId) query for filter user and deviceId.findUserDeviceByExpiredTokens(Timestamp expiredTokenDate) query for filter expired token of user devices.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getById, getOne, getReferenceById, saveAll, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByUserIdAndDeviceId
@Query("select ud from UserDevice ud where ud.deviceId = :deviceId and ud.user.id = :userId") UserDevice findByUserIdAndDeviceId(@Param("userId") String userId, @Param("deviceId") String deviceId) query for filter user and deviceId.- Parameters:
userId- user identifierdeviceId- unique identifier of the device..- Returns:
- UserDevice found in database.
-
findUserDeviceByExpiredTokens
@Query("select ud from UserDevice ud where ud.lastAccessDate <= :expiredTokenDate") List<UserDevice> findUserDeviceByExpiredTokens(@Param("expiredTokenDate") Timestamp expiredTokenDate) query for filter expired token of user devices.- Parameters:
expiredTokenDate- Last date for expire token.- Returns:
- List with user device with expired tokens.
-