Site hosted by Angelfire.com: Build your free website today!
   
SQL Code Sample

The following code retrieves all skills associated with an applicant.  Please note the SQL statement that is used to do this.
/**
* Perform the retrieveApplicantSkills method.
*/

public void retrieveApplicantSkills() throws com.ibm.ivj.eab.dab.DAException {

//clear the skills list box
getSelectedApplicantSkills().removeAllElements();

getDbSkillManager().select("," + jobsdb.Skill.getQualifier() + "ApplicantSkill T2 where T1.id = T2.skillid and T2.applicantid = " + getApplicantData().getId());
//T1 above represents the Skill Table and T2 the ApplicantSkill Table

//The following line of code will place the database skill objects in our
//manager into a local variable called skills of type Vector.
java.util.Vector skills = getDbSkillManager().items().getVector(); //place skill object
//from the SkillManager object to the Vector object

//Loop through vector and create new object of type SkillData.
//When object is created, look at each database skill row in vector and set the
//id and name properties of our SkillData object to the values that come from our
//dbSkill objects
for (int i = 0; i < skills.size(); i++)
{

//Create a new object of type SkillData to put in our list for each iteration.

SkillData skillX = new SkillData();

//Cast object from vector to specific type (e.g. jobsdb.Skill) 

setDbSkill((jobsdb.Skill)skills.elementAt(i));

//Set the id and name properties in our SkillData to
//the values in our dbSkill object.

skillX.setId(getDbSkill().getId());
skillX.setName(getDbSkill().getName());

//add the object to the list model
getSelectedApplicantSkills().addElement(skillX);

}//end for
}//end method

     




Essentials of eBusiness / Java / Visual Basic / DB2 / Peer Evaluations / Biography