Here you can find the source of getViewIdsForTypes(Connection connection, String... types)
public static List<Long> getViewIdsForTypes(Connection connection, String... types) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class Main { public static List<Long> getViewIdsForTypes(Connection connection, String... types) throws SQLException { ArrayList<Long> ids = new ArrayList<>(); StringBuilder sql = new StringBuilder("SELECT id FROM portti_view"); if (types != null && types.length > 0) { sql.append(" WHERE type IN (?"); for (int i = 1; i < types.length; ++i) { sql.append(", ?"); }/* ww w. j ava 2s. c o m*/ sql.append(")"); } try (final PreparedStatement statement = connection .prepareStatement(sql.toString())) { if (types != null) { for (int i = 0; i < types.length; ++i) { statement.setString(i + 1, types[i]); } } try (ResultSet rs = statement.executeQuery()) { while (rs.next()) { ids.add(rs.getLong("id")); } } } return ids; } }