Query to get nextval from sequence in Spring JPA while using different databases

Viewed 139

I need a query to get nextval of a sequence even when I change the database (I have Oracle and Postgres) When I try to use @Query(nativeQuery = true, value = "SELECT nextval('SEQUENCE_USER')") it works with Postgres but not in Oracle Same with @Query(nativeQuery = true, value = "SELECT SEQUENCE_USER.nextval FROM DUAL") works with Oracle and not with Postgres is there some kind of query that can work with both?

0 Answers
Related