PreparedStatement pstmt = conn.prepareStatement("INSERT INTO texttable (te) VALUES (?)", new String[] {"ctid"});
pstmt.setString(1, "some text");
pstmt.executeUpdate();
ResultSet keys = pstmt.getGeneratedKeys();
assertTrue(keys.next());
RowId rowId = keys.getRowId(1);
keys.close();
pstmt.close();
pstmt = conn.prepareStatement("SELECT te FROM texttable WHERE ctid = ?");
pstmt.setRowId(1, rowId);