No need the constructor......
//This is normal bean or (accessor class)
public class Emp{
private long empId=0;
private
String empName=null;
private String empDesg=null;
public void setEmpId(long empId){
this.empId=empId;
}
public void setEmpName(String empName){
this.empName=empName;
}
public void setEmpDesg(String empDesg){
this.empDesg=empDesg;
}
public long getEmpId(){
return this.empId;
}
public String getEmpName(){
return this.empName;
}
pulbic String getEmpDesg(){
return this.empDesg;
}
}
//This is Entity or session ....class
class EmpClass....{
//This is main function for getting the only one specified row
public Emp getObject(long empId) throws FinderException {
Connection dbConnection=null;
Statement st=null;
ResultSet rs=null;
String strQry=null;
Emp empTb=null;
try{
dbConnection = getConnection();
strQry = " SELECT EMPID,EMPNAME,EMPDESG "+
" FROM EMPTB WHERE USERID = "+empId;
st = dbConnection.createStatement();
rs = st.executeQuery(strQry);
if(!rs.next()){
throw new FinderException("RECORD IS NOT FOUND INTHE TABLE");
}else{
empTb = new Emp();
empTb.setEmpId(rs.getString(1));
empTb.setEmpName(rs.getString(2));
empTb.setEmpDesg(rs.getString(3));
return empTb;
}
}catch(Exception e){
throw new FinderException(e.getMessage());
}finally{
..
rs.close();
st.close();
dbConnection.close();
}
}
}//End class