Hi,
I've found what appears to be a bug in code generated with Jonas V2.2.4. In
the code snippet below, you'll see that when the requested key is not found
in the database, an ObjectNotFoundException is thrown. Then the exception
that was just thrown is caught and a new FinderException is thrown instead.
The result is that the caller will never be able to catch an
ObjectNotFoundException (and there will always be an error message on the
output for what may not actually be an error :-) ).
public com.compuware.cgf.beans.core.InTypeID
ejbFindByPrimaryKey(com.compuware.cgf.beans.core.InTypeID p1) throws
javax.ejb.FinderException {
TraceEjb.debugGenIC("JOnAScom_compuware_aqp_beans_dectree_DecisionTreeNodeHo
me.ejbFindByPrimaryKey(com.compuware.cgf.beans.core.InTypeID)");
Connection conn = null;
PreparedStatement pStmt = null;
try {
DataSource ds = (DataSource)(this.ejbHome.getDataSource());
conn = ds.getConnection();
pStmt = conn.prepareStatement("select SCOPE, ID, VERSION from
T_DECISION_TREE_NODE where SCOPE=? and ID=? and VERSION=?");
pStmt.setInt(1, p1.m_iScopeID);
pStmt.setInt(2, p1.m_iID);
pStmt.setInt(3, p1.m_iVersionNum);
ResultSet rs = pStmt.executeQuery();
if (rs.next() == false) {
TraceEjb.error("Object not found in database (findByPrimaryKey)");
throw new ObjectNotFoundException("Object not found in database
(findByPrimaryKey)");
}
} catch (Exception e) {
TraceEjb.error("Failed to find bean from database (findByPrimaryKey)",
e);
throw new FinderException("Failed to find bean from database
(findByPrimaryKey)");
} finally {
if (pStmt != null) {
try {
pStmt.close();
} catch (Exception ignore) {
TraceEjb.error("Failed to close the PreparedStatement
(findByPrimaryKey)" ,ignore);
}
}
if (conn != null) {
try {
conn.close();
} catch (Exception ignore) {
TraceEjb.error("Failed to close the Connection
(findByPrimaryKey)" ,ignore);
}
}
}
return(p1);
}
Is this actually a bug or was it intended to operate this way?
Thanks,
Randy Nolen
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".