From: | Dave Cramer <pg(at)fastcrypt(dot)com> |
---|---|
To: | Chris Dole <chris(dot)dole(at)sas(dot)com> |
Cc: | List <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: MyBatis Batch Update Leads to PSQLException "Too many update results were returned" |
Date: | 2018-03-02 21:05:13 |
Message-ID: | CADK3HH+pJ9iKg1J85Xxm9mEKm20yO4iWf1u_G4iVb70eU7L_xw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Please upgrade to a more recent version of the driver and retest., we would
not backpatch. 9.4 drivers
Dave Cramer
davec(at)postgresintl(dot)com
www.postgresintl.com
On 27 February 2018 at 16:19, Chris Dole <chris(dot)dole(at)sas(dot)com> wrote:
> I have a fairly simple implementation of a batch update via the MyBatis
> functionality.
>
> Postgres version (via RDS on Amazon Web Services): 9.6.6
> JDBC driver version: 9.4
>
> The error manifests as follows:
>
> DataIntegrityViolationException
> Root cause: BatchUpdateException
> getNextException: PSQLException - Too many update results were returned.
>
> Has anyone else run into this? I have searched far and wide for an
> explanation (including here) but have not found an answer yet.
>
> I assume this error is coming up from the JDBC driver?
>
> The curious thing is that the update seems to work (as in database
> side-effects) but it still throws an exception afterward.
>
> Here is a fragment of the MyBatis mapper XML file for the update. The
> failure can happen for as few as two or three updates, and it can succeed
> with hundreds.
>
> <update id="update" parameterType="java.util.List">
> <foreach collection="list" item="item" index="index" separator=";">
> UPDATE public.vid_event_timing SET mark_delete = 1 WHERE
> visitor_id=#{item.vid} AND timed_node_id=#{item.timedNodeId}
> AND
> conditional_node_id= #{item.conditionalNodeId}
> </foreach>
> </update>
>
> The MyBatis/Spring configuration includes this session factory bean, set to
> ExecutorType.BATCH by default.
>
> @Bean
> public SqlSessionTemplate getSqlSessionTemplate()
> {
> SqlSessionFactory sessionFactory = null;
> try
> {
> sessionFactory =
> getMktPersistDesignSqlSessionFactoryBean().getObject();
>
> sessionFactory.getConfiguration().setDefaultExecutorType(
> ExecutorType.BATCH);
> }
> catch (Exception e)
> {
> String message = PersistLogUtil.error(logger, "Failed to create
> SqlSessionTemplate");
> throw new RuntimeException(message, e);
> }
> SqlSessionTemplate template = new
> SqlSessionTemplate(sessionFactory);
> return template;
> }
>
> Thanks for any help.
>
>
>
>
> --
> Sent from: http://www.postgresql-archive.org/PostgreSQL-jdbc-f2168246.html
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Dole | 2018-03-02 21:13:56 | Re: MyBatis Batch Update Leads to PSQLException "Too many update results were returned" |
Previous Message | Christopher BROWN | 2018-03-02 15:27:17 | Re: Handling transaction failure due to concurrency errors |