On Thu, 2012-07-12 at 06:35 +0530, Kiran Badi wrote: > Hi, > > I have below code for catching DAO exceptions,
No, it's not. It's code that defines an interface and a poorly
implemented exception type. There's no catching. Anywhere.
> but I feel its not correct
> way to do this,Can some one point me to some library which will capture
> all exceptions which my code will throw and works with tomcat. I
> implementing Model2 mvc pattern and to my surprise I am able to show
> values to the view but database is not getting inserted.I am lost given
> that no exception is also being thrown anywhere.All logs looks clean but
> DB is not updated.
>
> import java.sql.Connection;
>
> public interface DAO {
>
> Connection getConnection() throws DAOException;
>
> }
>
> public class DAOException extends Exception {
> private static final long serialVersionUID = 19192L;
>
> public DAOException() {
> }
> public DAOException(String message) {
> this.message = message;
> }
> @Override
> public String getMessage() {
> return message;
> }
> public void setMessage(String message) {
> this.message = message;
> }
> private String message;
>
> @Override
> public String toString() {
> return message;
> }
> }
>
Other than including Tomcat in the subject, this has nothing to do with
Tomcat. No offense, but this really isn't a list for teaching Java.
But what the hell, I'll make one "exception":
public class DAOException extends Exception {
public DAOException(String msg) {
super();
}
public DAOException(String msg) {
super(msg);
}
public DAOException(String msg, Throwable cause) {
super(msg, cause);
}
public DAOException(Throwable cause) {
super(cause);
}
}
That's all I'll say on this thread.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
signature.asc
Description: This is a digitally signed message part
