use of models.ProjectBean in project bil372-proje by mertserezli.
the class SearchDAO method searchForProjectDescription.
public static List<ProjectBean> searchForProjectDescription(String descriptionRequest) throws SQLException {
List<ProjectBean> result = new ArrayList<ProjectBean>();
PreparedStatement ps = null;
String searchQuery = "Select DISTINCT * From PROJECT Where UPPER(Description) LIKE UPPER('%" + descriptionRequest + "%')";
try {
ConnectionManager connect = new ConnectionManager();
currentConnection = connect.getConnection();
ps = currentConnection.prepareStatement(searchQuery);
rs = ps.executeQuery();
while (rs.next()) {
ProjectBean project = new ProjectBean();
project.setTitle(rs.getString("Title"));
project.setDescription(rs.getString("Description"));
project.setPid(rs.getInt("Pid"));
project.setState(rs.getString("State"));
project.setVotenum(rs.getInt("Votenum"));
project.setCreation_Date(rs.getDate("Creation_Date"));
result.add(project);
}
} finally {
finalizeConnection(currentConnection, ps, rs);
}
return result;
}
Aggregations