You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Lieven De Keyzer <li...@hotmail.com> on 2005/05/09 03:39:59 UTC

SQLException when deleting

This is a snapshot of my AccountSqlMapDao, following the concepts of the 
latest JPetStore.


  public void insertAccount(Account account) {
    insert("insertAccount", account);
  }

  public void updateAccount(Account account) {
    update("updateAccount", account);
  }

  public void deleteAccount(Account account) {
      delete("deleteAccount", account);
  }


I get an error however in deleteAccount:

unreported exception java.sql.SQLException; must be caught or declared to be 
thrown

[javac]     delete("deleteAccount", account);


Why do I need to catch the exception for the delete statement, but not for 
the insert or update method?



Re: SQLException when deleting

Posted by Lieven De Keyzer <li...@hotmail.com>.

>From: Clinton Begin <cl...@gmail.com>
>Reply-To: cbegin@ibatis.com
>To: ibatis-user-java@incubator.apache.org
>Subject: Re: SQLException when deleting
>Date: Sun, 8 May 2005 21:45:01 -0600
>
>Odd....the DAO template doesn't throw an exception...
>
>  public int delete(String id, Object parameterObject) {
>
>
>Maybe you're using an old version of the framework?
>
>
>Cheers,
>Clinton
>
>
>
>
>On 5/8/05, Lieven De Keyzer <li...@hotmail.com> wrote:
> >
> > This is a snapshot of my AccountSqlMapDao, following the concepts of the
> > latest JPetStore.
> >
> > public void insertAccount(Account account) {
> > insert("insertAccount", account);
> > }
> >
> > public void updateAccount(Account account) {
> > update("updateAccount", account);
> > }
> >
> > public void deleteAccount(Account account) {
> > delete("deleteAccount", account);
> > }
> >
> > I get an error however in deleteAccount:
> >
> > unreported exception java.sql.SQLException; must be caught or declared 
>to
> > be
> > thrown
> >
> > [javac] delete("deleteAccount", account);
> >
> > Why do I need to catch the exception for the delete statement, but not 
>for
> > the insert or update method?
> >
> >



Re: SQLException when deleting

Posted by Clinton Begin <cl...@gmail.com>.
Odd....the DAO template doesn't throw an exception...

 public int delete(String id, Object parameterObject) {


Maybe you're using an old version of the framework?


Cheers,
Clinton




On 5/8/05, Lieven De Keyzer <li...@hotmail.com> wrote:
> 
> This is a snapshot of my AccountSqlMapDao, following the concepts of the
> latest JPetStore.
> 
> public void insertAccount(Account account) {
> insert("insertAccount", account);
> }
> 
> public void updateAccount(Account account) {
> update("updateAccount", account);
> }
> 
> public void deleteAccount(Account account) {
> delete("deleteAccount", account);
> }
> 
> I get an error however in deleteAccount:
> 
> unreported exception java.sql.SQLException; must be caught or declared to 
> be
> thrown
> 
> [javac] delete("deleteAccount", account);
> 
> Why do I need to catch the exception for the delete statement, but not for
> the insert or update method?
> 
>