Here you can find the source of extractGeneratedId(ResultSet generatedKeys)
public static Optional<Long> extractGeneratedId(ResultSet generatedKeys) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.ResultSet; import java.sql.SQLException; import java.util.Optional; public class Main { public static Optional<Long> extractGeneratedId(ResultSet generatedKeys) throws SQLException { if (generatedKeys.next()) { return Optional.of(generatedKeys.getLong(1)); }//from w ww . jav a 2 s . c o m return Optional.empty(); } }