Check out example codes for "getting next sequence value jpa postgress". It will help you in understanding the concepts better.

Code Example 1

@Query(value = "SELECT nextval('item_id_seq')", nativeQuery =
            true)
    Long getNextSeriesId();

Learn ReactJs, React Native from akashmittal.com