Re: Cannot insert to 'path' field using EclipseLink - Mailing list pgsql-jdbc

From Sehrope Sarkuni
Subject Re: Cannot insert to 'path' field using EclipseLink
Date
Msg-id CAH7T-aqgSFYZNAJOHY7Z=_PDXYG1CVPed6LZ1b45rpcZURNo=A@mail.gmail.com
Whole thread Raw
In response to Cannot insert to 'path' field using EclipseLink  (Daryl Foster <daryl.foster@oncenter.com>)
List pgsql-jdbc
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/


pgsql-jdbc by date:

Previous
From: Daryl Foster
Date:
Subject: Cannot insert to 'path' field using EclipseLink
Next
From: Daryl Foster
Date:
Subject: Re: Cannot insert to 'path' field using EclipseLink