[postgis-users] Postgis 9.0.1 and JDBC problems.

Knut Aksnes-NOR Knut.Aksnes at jeppesen.com
Mon Aug 20 02:59:01 PDT 2012

I am trying to use postgis geography thru Eclipselink using postgres-jdbc and have had a few problems at least at least one of them is still holding me up.

First problem is that I had to build the driver myself: I have had no luck in finding it in any publically available maven repository.
Second problem: PGgeometry is broken; More specifically it implements Serializable, but contains a nonserializable non transient member:
BinaryParser bp = new BinaryParser();

This is easily fixed by changing it to:
transient BinaryParser bp = new BinaryParser();

The third problem is that there seems to be something  wrong related to endianness as I get this message when I try to flush my changes to EclipseLink.

Internal Exception: org.postgresql.util.PSQLException: ERROR: Invalid endian flag value encountered.

Some extra information:

I do insert postgis dependencies using this piece of code:
	final org.postgresql.PGConnection connection = (PGConnection) ((EntityManagerImpl) em)
		connection.addDataType("box3d", Class.forName("org.postgis.PGbox3d"));

The JPA attribute definition is shown here:

@Basic(optional = true, fetch = LAZY)
@Column(columnDefinition = "GEOGRAPHY(MULTIPOLYGON,4326)", insertable = true, updatable = true, nullable = true)
private PGgeometry coverageArea;

For postgis I am using the postgis 9.0.1 jdbc4 driver
Even inserting nulls seems to create this endian flag value exception.

More information about the postgis-users mailing list