// Данный метод просто показывает, как делается запрос при работе на уровне JDBC private void oldJDBC() { Connection connection = null; Statement statement = null; ResultSet rs = null; try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/db_applicant", "root", "root"); statement = connection.createStatement(); List<Profession> list = new ArrayList<Profession>(); rs = statement.executeQuery( "select profession_id, profession_name from profession " + "order by profession_name"); while (rs.next()) { Profession r = new Profession(); r.setProfessionId(rs.getLong("profession_id")); r.setProfessionName(rs.getString("profession_name")); list.add(r); System.out.println(r.getProfessionId() + ":" + r.getProfessionName()); } } catch (SQLException ex) { ex.printStackTrace(); System.err.println("Error SQL execution: " + ex.getMessage()); } catch (ClassNotFoundException ex) { ex.printStackTrace(); System.err.println("Error SQL execution: " + ex.getMessage()); } finally { try { if (rs != null) { rs.close(); } if (statement != null) { statement.close(); } if (connection != null) { connection.close(); } } catch (SQLException ex) { ex.printStackTrace(); System.err.println("Error: " + ex.getMessage()); } } }