File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC

 
Jimmy Lopez
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day everyone, I am an entry level Java developer and I am trying to figure out this code;

public LinkedList selectEmployeeList(String department)
throws ServletException, WalgreensDataException, PMTException {

DataAccess da = null;
LinkedList employeeList = new LinkedList();
StringBuffer sqlQuery = new StringBuffer();
sqlQuery.append("select dept.auth_id, ");
sqlQuery.append("emp.first_name, ");
sqlQuery.append("emp.last_name, ");
sqlQuery.append("emp.active_ind, ");
sqlQuery.append("emp.task_ind, ");
sqlQuery.append("emp.project_ind ");
sqlQuery.append("from rts_employee emp, ");
sqlQuery.append("rts_emp_dept dept ");
sqlQuery.append("where emp.auth_id = dept.auth_id ");
sqlQuery.append("and dept.department = ? ");
sqlQuery.append("and dept.default_dept_ind = ? ");
sqlQuery.append("order by active_ind desc, emp.last_name");

da = new DataAccess(conn, sqlQuery.toString());
da.setSQL(sqlQuery.toString());
da.setString(1, department);
da.setString(2, PMTConstants.ACTIVE);

da.executeQuery();


while (da.next()) {
EmployeeBean emp = new EmployeeBean();
emp.setAuthId(da.getString("AUTH_ID"));
emp.setFirstName(da.getString("FIRST_NAME"));
emp.setLastName(da.getString("LAST_NAME"));
emp.setActiveInd(da.getString("ACTIVE_IND"));
emp.setTaskInd(da.getString("TASK_IND"));
emp.setProjectInd(da.getString("PROJECT_IND"));

employeeList.add(emp);
}

if (da != null) {
da.close();
}


return employeeList;
} // end of selectEmployeeList


Any suggestions ?
 
stu derby
Ranch Hand
Posts: 333
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am trying to figure out this code;

Any suggestions ?


Ask a more specific question. Are you saying that this is your code and doesn't work? How not? Or is the code you found some where and you want to know what it does and how it works?

Here's a commented version (with a minor change or two); not the effect of using the code tags to make it more readable.


Hope that helps.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic