Re: Cannot insert to 'path' field using EclipseLink

From: Sehrope Sarkuni <sehrope(at)jackdb(dot)com>
To: Daryl Foster <daryl(dot)foster(at)oncenter(dot)com>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Cannot insert to 'path' field using EclipseLink
Date: 2014-03-12 13:18:34
Message-ID: CAH7T-aqgSFYZNAJOHY7Z=_PDXYG1CVPed6LZ1b45rpcZURNo=A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc pgsql-novice

Daryl-

I'm not too familiar with EclipseLink but looks like the problem is
there and not with the PG JDBC driver.

If you use the JDBC driver directly and call setObject(...) to bind
the PGpath parameter, it works fine for both null and not-null values
(tested with the latest 9.3 JDBC driver against a 9.3 database):

Table:
CREATE TABLE path_sample (name text, item_path path);

Java:
Connection conn = ...
String sql = "INSERT INTO path_sample (name, item_path) VALUES (?, ?)";
PreparedStatement stmt = conn.prepareStatement(sql);
// Insert a not null point:
stmt.setString(1, "foobar");
stmt.setObject(2, new PGpath(new PGpoint[] {new PGpoint(0, 0), new
PGpoint(1, 1)}, false));
stmt.execute();
// Insert a null point:
stmt.setString(1, "null point");
stmt.setObject(2, null);
stmt.execute();

My guess is that EclipseLink isn't calling setObject(...). I suggest
you enable more debug logs for EclipseLink to see exactly what it's
doing and how it's binding the statement parameters. Your converter is
probably not being used properly.

Regards,
Sehrope Sarkuni
Founder & CEO | JackDB, Inc. | http://www.jackdb.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ian Lawrence Barwick 2014-03-12 13:28:03 Re: Materialized view from PG to Oracle?
Previous Message matshyeq 2014-03-12 13:05:40 Re: libpq - lack of support to set the fetch size

Browse pgsql-jdbc by date

  From Date Subject
Next Message Daryl Foster 2014-03-12 17:12:20 Re: Cannot insert to 'path' field using EclipseLink
Previous Message Daryl Foster 2014-03-12 12:37:08 Cannot insert to 'path' field using EclipseLink

Browse pgsql-novice by date

  From Date Subject
Next Message Adam Mackler 2014-03-12 16:43:29 What is the difference between INSERT...RETURN and pl/pgsql RETURNING?
Previous Message Daryl Foster 2014-03-12 12:37:08 Cannot insert to 'path' field using EclipseLink