Exemplo n.º 1
0
 private CV createCV() {
   CV cv = new CV();
   Category category = new Category();
   category.setName("Technology");
   cv.setCategory(Collections.singletonList(category));
   User user = new User();
   user.setGender(Gender.FEMALE);
   user.setName("Ann");
   cv.setOwner(user);
   cv.setText("Python, Java, Ruby");
   cv.setTitle("Software developer");
   return cv;
 }
Exemplo n.º 2
0
  public List<User> getMessageUserList(String userName) {
    List<User> userList;
    userList = new ArrayList<User>();

    User user = new User();
    try {

      Statement sta = con.createStatement();

      final String selSQL = "SELECT * FROM \"USER\" Where USERNAME = ?";

      PreparedStatement ps;
      ResultSet rs = null;

      ps = con.prepareStatement(selSQL);
      ps.setString(1, userName);
      rs = ps.executeQuery();

      if (rs.next()) {
        user.setName(rs.getString("NAME"));
        user.setUsurname(rs.getString("USERNAME"));
        user.setId(rs.getInt("ID"));
      } else {
        user = null;
      }
      rs.close();
      ps.close();
      sta.close();

    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (Exception e) {
      // Handle errors for Class.forName
      e.printStackTrace();
    } finally {

    }

    return userList;
  }