Hi All,
This is a simple question for you Java Gurus out there. My bean needs to return an integer. The error msg I get "Integer can't be resolved or is not a type". How do I set favNbr to return an integer?
TIA,
Tim
This is a simple question for you Java Gurus out there. My bean needs to return an integer. The error msg I get "Integer can't be resolved or is not a type". How do I set favNbr to return an integer?
TIA,
Tim
Code:
public Integer getFavNumber(String _companyID, String _operatorID) throws ISCException {
if(SysLog.eventEnabled(7))
SysLog.logSimpleEvent(7, "OAEPDSP", "Entering SessConnectEJBBean getFavNumber()");
Connection conn = DBConnFactory.getDBConn();
Integer favNbr;
PreparedStatement prepStmt = null;
ResultSet resSet = null;
StringBuffer query = new StringBuffer();
favNbr = new integer[0];
try {
query.append("SELECT MAX(favNum) AS favNum ");
query.append("FROM custom_report ");
query.append("WHERE companyID = '" + _companyID + "' ");
query.append("AND operatorID = '" + _operatorID + "' ");
prepStmt = conn.prepareStatement(query.toString());
//dealing with Oracle bug...
for (int i = 0;; i++) {
try {
//Running query...
resSet = prepStmt.executeQuery();
} catch (SQLException SQLE) {
//8177: ERROR caused by Oracle's optimistic concurrency. Need to re-execute...
if (SQLE.getErrorCode() == 8177) {
} else {
throw SQLE;
}
}
break;
}
//Reading Resultset...
while(resSet.next()) {
//FavNum
favNbr = new Integer(resSet.getInt("favNum"));
}
}catch(Exception e) {
if(e instanceof ISCException)
throw (ISCException)e;
StringPrintStream sps=new StringPrintStream(new StringStream());
e.printStackTrace(sps);
SysLog.logSimpleEvent(1, "OAXPDSP", getClass().getName() + ".getFavNumber(): ");
throw new ISCException("OAXPDSP");
} finally {
try {
if (prepStmt != null) {
prepStmt.close();
}
if (conn != null) {
conn.close();
}
} catch (Exception e) {
SysLog.logSimpleEvent(1, "OAXPDSP", "Exception in getFavNumber() finally.");
}
}
return favNbr;
}