Created
October 17, 2024 05:29
-
-
Save sandipchitale/ebf68f4e62ec307fd9c3df958a435bbf to your computer and use it in GitHub Desktop.
Use ctid in spring data JPS repository #postgres #sringdatajpa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.data.jpa.repository.Query; | |
import org.springframework.data.repository.CrudRepository; | |
import java.util.Optional; | |
public interface NamesToDiff1Repository extends CrudRepository<NamesToDiff1, Long> { | |
@Query(value = "SELECT ctid FROM names", nativeQuery = true) | |
Iterable<Object> findAllRowIds(); | |
@Query(value = "SELECT * FROM names WHERE ctid = ?::tid", nativeQuery = true) | |
Optional<NamesToDiff1> findByCtId(String ctid); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment