Ibatis Update returns -1

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Ibatis Update returns -1

java freak
All,

I am having an issue with ibatis Update. It returns a -1. What is
causing this issue and how to resolve it. I am  using IDMS Database.
It works fine in our local environment and when move to the Integrated
development environment it is failing.

Would appreciate quick response.

TIA,
Reply | Threaded
Open this post in threaded view
|

Re: Ibatis Update returns -1

Richard Yee
What version are you using?

How about showing some of your source code?

-Richard

On Mon, May 16, 2011 at 6:30 PM, java freak <[hidden email]> wrote:
All,

I am having an issue with ibatis Update. It returns a -1. What is
causing this issue and how to resolve it. I am  using IDMS Database.
It works fine in our local environment and when move to the Integrated
development environment it is failing.

Would appreciate quick response.

TIA,

Reply | Threaded
Open this post in threaded view
|

Re: Ibatis Update returns -1

java freak
I am using mybatis-3.0.1.jar.
THE IDMS Version is 17.
Websphere 6.1 and JDK 1.5

Here the code snippet:

SqlSession session = getSessionFactory().openSession();
                try {

                        ApplMapper dao = session.getMapper(ApplMapper.class);
                        ApplExample e = new ApplExample();
                        Criteria crit = e.createCriteria();

                        Log.debug( "ApplicantDAOImpl:Searching: " + ssn);
                        crit.andApplSsnEqualTo( new Integer(ssn));
                  int rval = dao.deleteByPrimaryKey(new Integer(ssn));

                        if ( rval != 1){
                                String mesg = "Failed to delete selectee : " + ssn;
                                Log.debug(mesg );
                                throw new DAOException( mesg);
                        }
                        else
                            session.commit();
                } catch (Throwable t) {
                        Log.logException(t);
                        throw new HitsDAOException(t.getMessage(), t);
                } finally {
                        closeSession(session);
                }

On May 16, 11:45 pm, Richard Yee <[hidden email]> wrote:

> What version are you using?
>
> How about showing some of your source code?
>
> -Richard
>
>
>
>
>
>
>
> On Mon, May 16, 2011 at 6:30 PM, java freak <[hidden email]> wrote:
> > All,
>
> > I am having an issue with ibatis Update. It returns a -1. What is
> > causing this issue and how to resolve it. I am  using IDMS Database.
> > It works fine in our local environment and when move to the Integrated
> > development environment it is failing.
>
> > Would appreciate quick response.
>
> > TIA,
Reply | Threaded
Open this post in threaded view
|

Re: Ibatis Update returns -1

Clinton Begin
Administrator
Are you using the batch executor?  If so, that could happen.  Try the simple executor to see if it changes.  

Cheers,
Clinton

On Tue, May 17, 2011 at 7:44 AM, java freak <[hidden email]> wrote:
I am using mybatis-3.0.1.jar.
THE IDMS Version is 17.
Websphere 6.1 and JDK 1.5

Here the code snippet:

SqlSession session = getSessionFactory().openSession();
               try {

                       ApplMapper dao = session.getMapper(ApplMapper.class);
                       ApplExample e = new ApplExample();
                       Criteria crit = e.createCriteria();

                       Log.debug( "ApplicantDAOImpl:Searching: " + ssn);
                       crit.andApplSsnEqualTo( new Integer(ssn));
                       int rval = dao.deleteByPrimaryKey(new Integer(ssn));

                       if ( rval != 1){
                               String mesg = "Failed to delete selectee : " + ssn;
                               Log.debug(mesg );
                               throw new DAOException( mesg);
                       }
                       else
                           session.commit();
               } catch (Throwable t) {
                       Log.logException(t);
                       throw new HitsDAOException(t.getMessage(), t);
               } finally {
                       closeSession(session);
               }

On May 16, 11:45 pm, Richard Yee <[hidden email]> wrote:
> What version are you using?
>
> How about showing some of your source code?
>
> -Richard
>
>
>
>
>
>
>
> On Mon, May 16, 2011 at 6:30 PM, java freak <[hidden email]> wrote:
> > All,
>
> > I am having an issue with ibatis Update. It returns a -1. What is
> > causing this issue and how to resolve it. I am  using IDMS Database.
> > It works fine in our local environment and when move to the Integrated
> > development environment it is failing.
>
> > Would appreciate quick response.
>
> > TIA,

Reply | Threaded
Open this post in threaded view
|

Re: Ibatis Update returns -1

java freak
Earlier we had the executor type as 'REUSE'. Had this issue. Changed
it to SIMPLE. We are still facing this issue.

On May 17, 10:08 am, Clinton Begin <[hidden email]> wrote:

> Are you using the batch executor?  If so, that could happen.  Try the simple
> executor to see if it changes.
>
> Cheers,
> Clinton
>
>
>
>
>
>
>
> On Tue, May 17, 2011 at 7:44 AM, java freak <[hidden email]> wrote:
> > I am using mybatis-3.0.1.jar.
> > THE IDMS Version is 17.
> > Websphere 6.1 and JDK 1.5
>
> > Here the code snippet:
>
> > SqlSession session = getSessionFactory().openSession();
> >                try {
>
> >                        ApplMapper dao =
> > session.getMapper(ApplMapper.class);
> >                        ApplExample e = new ApplExample();
> >                        Criteria crit = e.createCriteria();
>
> >                        Log.debug( "ApplicantDAOImpl:Searching: " + ssn);
> >                        crit.andApplSsnEqualTo( new Integer(ssn));
> >                        int rval = dao.deleteByPrimaryKey(new Integer(ssn));
>
> >                        if ( rval != 1){
> >                                String mesg = "Failed to delete selectee : "
> > + ssn;
> >                                Log.debug(mesg );
> >                                throw new DAOException( mesg);
> >                        }
> >                        else
> >                            session.commit();
> >                } catch (Throwable t) {
> >                        Log.logException(t);
> >                        throw new HitsDAOException(t.getMessage(), t);
> >                } finally {
> >                        closeSession(session);
> >                 }
>
> > On May 16, 11:45 pm, Richard Yee <[hidden email]> wrote:
> > > What version are you using?
>
> > > How about showing some of your source code?
>
> > > -Richard
>
> > > On Mon, May 16, 2011 at 6:30 PM, java freak <[hidden email]> wrote:
> > > > All,
>
> > > > I am having an issue with ibatis Update. It returns a -1. What is
> > > > causing this issue and how to resolve it. I am  using IDMS Database.
> > > > It works fine in our local environment and when move to the Integrated
> > > > development environment it is failing.
>
> > > > Would appreciate quick response.
>
> > > > TIA,
Reply | Threaded
Open this post in threaded view
|

Re: Ibatis Update returns -1

java freak
Can someone help. I am clueless and don't what is causing this issue ?

On May 17, 11:18 am, java freak <[hidden email]> wrote:

> Earlier we had the executor type as 'REUSE'. Had this issue. Changed
> it to SIMPLE. We are still facing this issue.
>
> On May 17, 10:08 am, Clinton Begin <[hidden email]> wrote:
>
>
>
>
>
>
>
> > Are you using the batch executor?  If so, that could happen.  Try the simple
> > executor to see if it changes.
>
> > Cheers,
> > Clinton
>
> > On Tue, May 17, 2011 at 7:44 AM, java freak <[hidden email]> wrote:
> > > I am using mybatis-3.0.1.jar.
> > > THE IDMS Version is 17.
> > > Websphere 6.1 and JDK 1.5
>
> > > Here the code snippet:
>
> > > SqlSession session = getSessionFactory().openSession();
> > >                try {
>
> > >                        ApplMapper dao =
> > > session.getMapper(ApplMapper.class);
> > >                        ApplExample e = new ApplExample();
> > >                        Criteria crit = e.createCriteria();
>
> > >                        Log.debug( "ApplicantDAOImpl:Searching: " + ssn);
> > >                        crit.andApplSsnEqualTo( new Integer(ssn));
> > >                        int rval = dao.deleteByPrimaryKey(new Integer(ssn));
>
> > >                        if ( rval != 1){
> > >                                String mesg = "Failed to delete selectee : "
> > > + ssn;
> > >                                Log.debug(mesg );
> > >                                throw new DAOException( mesg);
> > >                        }
> > >                        else
> > >                            session.commit();
> > >                } catch (Throwable t) {
> > >                        Log.logException(t);
> > >                        throw new HitsDAOException(t.getMessage(), t);
> > >                } finally {
> > >                        closeSession(session);
> > >                 }
>
> > > On May 16, 11:45 pm, Richard Yee <[hidden email]> wrote:
> > > > What version are you using?
>
> > > > How about showing some of your source code?
>
> > > > -Richard
>
> > > > On Mon, May 16, 2011 at 6:30 PM, java freak <[hidden email]> wrote:
> > > > > All,
>
> > > > > I am having an issue with ibatis Update. It returns a -1. What is
> > > > > causing this issue and how to resolve it. I am  using IDMS Database.
> > > > > It works fine in our local environment and when move to the Integrated
> > > > > development environment it is failing.
>
> > > > > Would appreciate quick response.
>
> > > > > TIA,
Reply | Threaded
Open this post in threaded view
|

Re: Ibatis Update returns -1

Jeff Butler
The returned value of -1 from an update means that the statement
returned a resultset - see javadoc for
java.sql.Statement.getUpdateCount()

Could your update be running a query?

Jeff Butler


On 5/18/11, java freak <[hidden email]> wrote:

> Can someone help. I am clueless and don't what is causing this issue ?
>
> On May 17, 11:18 am, java freak <[hidden email]> wrote:
>> Earlier we had the executor type as 'REUSE'. Had this issue. Changed
>> it to SIMPLE. We are still facing this issue.
>>
>> On May 17, 10:08 am, Clinton Begin <[hidden email]> wrote:
>>
>>
>>
>>
>>
>>
>>
>> > Are you using the batch executor?  If so, that could happen.  Try the
>> > simple
>> > executor to see if it changes.
>>
>> > Cheers,
>> > Clinton
>>
>> > On Tue, May 17, 2011 at 7:44 AM, java freak <[hidden email]> wrote:
>> > > I am using mybatis-3.0.1.jar.
>> > > THE IDMS Version is 17.
>> > > Websphere 6.1 and JDK 1.5
>>
>> > > Here the code snippet:
>>
>> > > SqlSession session = getSessionFactory().openSession();
>> > >                try {
>>
>> > >                        ApplMapper dao =
>> > > session.getMapper(ApplMapper.class);
>> > >                        ApplExample e = new ApplExample();
>> > >                        Criteria crit = e.createCriteria();
>>
>> > >                        Log.debug( "ApplicantDAOImpl:Searching: " +
>> > > ssn);
>> > >                        crit.andApplSsnEqualTo( new Integer(ssn));
>> > >                        int rval = dao.deleteByPrimaryKey(new
>> > > Integer(ssn));
>>
>> > >                        if ( rval != 1){
>> > >                                String mesg = "Failed to delete
>> > > selectee : "
>> > > + ssn;
>> > >                                Log.debug(mesg );
>> > >                                throw new DAOException( mesg);
>> > >                        }
>> > >                        else
>> > >                            session.commit();
>> > >                } catch (Throwable t) {
>> > >                        Log.logException(t);
>> > >                        throw new HitsDAOException(t.getMessage(), t);
>> > >                } finally {
>> > >                        closeSession(session);
>> > >                 }
>>
>> > > On May 16, 11:45 pm, Richard Yee <[hidden email]> wrote:
>> > > > What version are you using?
>>
>> > > > How about showing some of your source code?
>>
>> > > > -Richard
>>
>> > > > On Mon, May 16, 2011 at 6:30 PM, java freak <[hidden email]>
>> > > > wrote:
>> > > > > All,
>>
>> > > > > I am having an issue with ibatis Update. It returns a -1. What is
>> > > > > causing this issue and how to resolve it. I am  using IDMS
>> > > > > Database.
>> > > > > It works fine in our local environment and when move to the
>> > > > > Integrated
>> > > > > development environment it is failing.
>>
>> > > > > Would appreciate quick response.
>>
>> > > > > TIA,

--
Sent from my mobile device