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 Ivan Bojer <ib...@gmail.com> on 2009/06/17 18:59:53 UTC

Please HELP - IBatis not throwing Unique constraint exception

Hi,

I have a problem where IBatis never throws any of the constaint
exceptions. My set-up is:
- postgresql 8.3.5
- postgres JDBC type 3 driver
- ibator for DAO and POJO generation

I have a simple table which has an unique constraint on the column. e.g.

CREATE TABLE SCHEMA_CONF.dns_suffix (
    suffix VARCHAR(128) NOT NULL UNIQUE,
);

The problem is that I can try to insert 'n' numbers of entries into it
and they will be rejected by database (as expected), but
I never get any SQLExceptions thrown back. Database logs clearly show
that commit was rejected because of UNIQUE constraint
violation.

What am I missing? Any hints?

Re: Please HELP - IBatis not throwing Unique constraint exception

Posted by Jeff Butler <je...@gmail.com>.
In that case all the DAO methods will throw SQLException if it is thrown by
the driver.  iBATIS/Ibator is doing nothing to "swallow" these exceptions -
you're driver is either not throwing them, or you are handling them at some
other layer of your application.

Jeff Butler


On Wed, Jun 17, 2009 at 12:31 PM, Ivan Bojer <ib...@gmail.com> wrote:

> My generator type is GENERIC-CI. I thought that IBATOR DAOGenerator
> type is deprecated.
>
> Please advise!
>
> Thank you.
>
> On Wed, Jun 17, 2009 at 10:05 AM, Larry Meadors<la...@gmail.com>
> wrote:
> > Are you using ibatis dao?
> >
> > It rethrows them as a DaoException which is a RuntimeException, IIRC.
> >
> > Larry
> >
> >
> > On Wed, Jun 17, 2009 at 10:59 AM, Ivan Bojer<ib...@gmail.com> wrote:
> >> Hi,
> >>
> >> I have a problem where IBatis never throws any of the constaint
> >> exceptions. My set-up is:
> >> - postgresql 8.3.5
> >> - postgres JDBC type 3 driver
> >> - ibator for DAO and POJO generation
> >>
> >> I have a simple table which has an unique constraint on the column. e.g.
> >>
> >> CREATE TABLE SCHEMA_CONF.dns_suffix (
> >>    suffix VARCHAR(128) NOT NULL UNIQUE,
> >> );
> >>
> >> The problem is that I can try to insert 'n' numbers of entries into it
> >> and they will be rejected by database (as expected), but
> >> I never get any SQLExceptions thrown back. Database logs clearly show
> >> that commit was rejected because of UNIQUE constraint
> >> violation.
> >>
> >> What am I missing? Any hints?
> >>
> >
>

Re: Please HELP - IBatis not throwing Unique constraint exception

Posted by Ivan Bojer <ib...@gmail.com>.
My generator type is GENERIC-CI. I thought that IBATOR DAOGenerator
type is deprecated.

Please advise!

Thank you.

On Wed, Jun 17, 2009 at 10:05 AM, Larry Meadors<la...@gmail.com> wrote:
> Are you using ibatis dao?
>
> It rethrows them as a DaoException which is a RuntimeException, IIRC.
>
> Larry
>
>
> On Wed, Jun 17, 2009 at 10:59 AM, Ivan Bojer<ib...@gmail.com> wrote:
>> Hi,
>>
>> I have a problem where IBatis never throws any of the constaint
>> exceptions. My set-up is:
>> - postgresql 8.3.5
>> - postgres JDBC type 3 driver
>> - ibator for DAO and POJO generation
>>
>> I have a simple table which has an unique constraint on the column. e.g.
>>
>> CREATE TABLE SCHEMA_CONF.dns_suffix (
>>    suffix VARCHAR(128) NOT NULL UNIQUE,
>> );
>>
>> The problem is that I can try to insert 'n' numbers of entries into it
>> and they will be rejected by database (as expected), but
>> I never get any SQLExceptions thrown back. Database logs clearly show
>> that commit was rejected because of UNIQUE constraint
>> violation.
>>
>> What am I missing? Any hints?
>>
>

Re: Please HELP - IBatis not throwing Unique constraint exception

Posted by Larry Meadors <la...@gmail.com>.
Are you using ibatis dao?

It rethrows them as a DaoException which is a RuntimeException, IIRC.

Larry


On Wed, Jun 17, 2009 at 10:59 AM, Ivan Bojer<ib...@gmail.com> wrote:
> Hi,
>
> I have a problem where IBatis never throws any of the constaint
> exceptions. My set-up is:
> - postgresql 8.3.5
> - postgres JDBC type 3 driver
> - ibator for DAO and POJO generation
>
> I have a simple table which has an unique constraint on the column. e.g.
>
> CREATE TABLE SCHEMA_CONF.dns_suffix (
>    suffix VARCHAR(128) NOT NULL UNIQUE,
> );
>
> The problem is that I can try to insert 'n' numbers of entries into it
> and they will be rejected by database (as expected), but
> I never get any SQLExceptions thrown back. Database logs clearly show
> that commit was rejected because of UNIQUE constraint
> violation.
>
> What am I missing? Any hints?
>