package com.cubetiqs.demo.repository; import com.cubetiqs.demo.domain.UserEntity; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import java.util.Optional; @Repository public interface UserRepository extends BaseRepository { Optional findFirstByEmail(String email); @Query(value = "select * from users u where u.email = ?1", nativeQuery = true) Optional fetchFirstByEmail(String email); @Query(value = "select * from users u", nativeQuery = true) Page fetchAllUsers(Pageable pageable); @Query(value = "select * from users u where lower(u.email) like ?1", nativeQuery = true) Page searchByEmail(String likeEmail, Pageable pageable); }