| DataObjectException class, used by Business Objects, catch all the
DataObject Exceptions, will be passed to POs and handled there.
Need to state the reasons.
Usage:
import myapp.business.*;
try {
some access of DOs
}
catch (SQLException sqlEx) {
if (sqlEx.getSQLState().startsWith("02") &&
(sqlEx.getErrorCode() == 100)) {
String msg = "Update or delete DO is out of synch";
throw new DataObjectException(msg, sqlEx);
}
else if (sqlEx.getSQLState().equals("S1000") &&
(sqlEx.getErrorCode() == -268)) {
String msg = "Integrity constraint violation";
throw new DataObjectException(msg, sqlEx);
}
else {
String msg = "Data Object Error";
throw new DataObjectException(msg, sqlEx);
}
}
catch (DatabaseManagerException connEx) {
String msg = "Database connection Error";
throw new DataObjectException(msg, connEx);
}
catch (ObjectIdException oidEx) {
String msg = "Object ID Error";
throw new DataObjectException(msg, oidEx);
}
version: $Revision: 1.1 $ |